Sample implementation of PHP/MySQL Boolean Search Engine
Suggested searches: “merlot or pinot” (Boolean OR) or “california and chardonnay” (Boolean AND). Quotation marks can be used to create a search on an exact phrase. Try “a good bottle” for a phrase search.
This search takes advantage of the whole array of Boolean fulltext searching in MySQL. It works essentially the same way that Google does, with a few slight twists. For easily communicated instructions, a Boolean “AND” can be queried by placing the term “AND” between terms. A Boolean "OR" query can be structured similarly: with “OR” placed between terms.
The form accepts up to six unique terms using these systems. For more complex queries, MySQL's Boolean modifiers can be used. See my article Working with Boolean Queries in MySQL/PHP for an explanation of these modifiers.
The default search is a word search: each word of your query is searched independently. By placing quotes around your search phrase you can search the exact phrase (like in Google).