News: MilkandCookies Turns Eight

Advanced Search Features

 
Jul 6, 2008 7:26 PM Comments: 4

A MilkandCookies query is broken up into terms and operators.

Terms

There are two types of terms: Single Terms and Phrases.

A Single Term is a single word such as banana.

A Phrase is a group of words surrounded by double quotes such as "All Your Base Are Belong To Us".

Multiple terms can be combined together with operators to form a more complex query (see below).

Operators

Operators allow terms to be combined through logic operators. Lucene supports AND, "+", OR, NOT and "-" as operators.

Note: Operators must be ALL CAPS.

OR

The OR operator is the default conjunction operator. This means that if there is no operator between two terms, the OR operator is used. The OR operator links two terms and finds a matching document if either of the terms exist in a document. This is equivalent to a union using sets. The symbol || can be used in place of the word OR.

To search for documents that contain either "peanut butter" or just "peanut" use either of these equivalent queries:

"peanut butter" peanut

"peanut butter" OR peanut

AND

The AND operator matches documents where both terms exist anywhere in the text of a single document. This is equivalent to an intersection using sets. The symbol && can be used in place of the word AND.

To search for documents that contain "peanut butter" and "jelly time" use the query:

"peanut butter" AND "jelly time"

+

The "+" or required operator requires that the term after the "+" symbol exist somewhere in a the field of a single document.

To search for documents that must contain "monkey" and may contain "peanut butter" use the query:

+monkey peanut butter

NOT

The NOT operator excludes documents that contain the term after NOT. This is equivalent to a difference using sets. The symbol ! can be used in place of the word NOT.

To search for documents that contain "peanut butter" but not "jelly time" use the query:

"peanut butter" NOT "jelly time"

Note: The NOT operator cannot be used with just one term. For example, the following search will return no results:

NOT "peanut butter"

-

The "-" or prohibit operator excludes documents that contain the term after the "-" symbol.

To search for documents that contain "peanut butter" but not "jelly time" use the query:

"peanut butter" -"jelly time"

Grouping

MilkandCookies Search supports using parentheses to group clauses to form sub queries. This can be very useful if you want to control the logic for a query.

To search for either "monkey" or "banana" and "website" use the query:

(monkey OR banana) AND website

This eliminates any confusion and makes sure you that website must exist and either term monkey or banana may exist.

Re: Advanced Search Features
Very nicely done. Thanks for the improvement.

One negative comment however, the M&C search function still doesn't handle apostrophes very well. Worse, in fact.
[ Reply ] [ Flag ] [ Root ] [ Thread ]
Re: Advanced Search Features
Whoops. The search actually works as advertised. My problem with the apostrophe wasn't the search results. Only what displayed in the resulting text box.

For example, I typed in DON'T and got don't in the text box. But the links that had the word in either the title or descriptions fields worked fine.
[ Reply ] [ Flag ] [ Root ] [ Thread ]
Re: Advanced Search Features
I switched the default behavior of the Search engine to use AND between words instead of OR. I think this makes better results.

The documentation on the Advanced Search page has been updated to reflect this.

You can still explicitly use OR in your queries.

Eg: Skiing OR Snowboarding

Of course don't forget quotes:

Eg: "Family Guy" OR "The Simpsons"
By: jaxon
[ Reply ] [ Flag ] [ Root ] [ Thread ]

RSS XML

The comments are property of their posters.

All logos and trademarks in this site are property of their respective owners.

Everything else © 2008 MilkandCookies.com.

DMCA