Search Language

The simplest way to perform a search is just to enter one or two keywords to search for, however, it is possible to perform far more advanced searches.

This section covers some of the ways searches can be performed. You may choose to include some of this detail on your web site to help you users perform advanced searches.

Query Terms

Words that appear by themselves in a search are called single terms, while multiple words that appear together surrounded by quotes are called a phrase. You can have any combination of these term types.

For example, the search term Recite CMS will search for documents that have both Recite and CMS in them, but the words don't have to appear together.

On the other hand, if you search for "Recite CMS", only documents that have the two words together as that phrase will be found.

Fields

Earlier in the chapter I covered viewing the details of a single document in a search index (by clicking on it in the document listing). Each row in the dialog that appears indicates a different field stored for the document.

You can search within a specific field by prefixing the search term with the field name. For example, if a field called title is indexed, you can search for the term people in this field by using the search term title:people.

If you want to search for multiple words in a field you must quote the words. For example, title:"hello goodbye".

Wildcards

You can include wildcards in your search using the ? and * characters. The ? will is a wildcard for a single character, while * is for one or more characters.

For example, te?t will match test, tent or text, but not tempt.

On the other hand, if you search for te*t, then tempt would be found.

Range Searches

You can search between an upper and lower bound by using a range search.

For example, if you searched for fruit:{Apple TO Orange}, the fruit would be searched for everything that lies between apple and orange (when sorted alphabetically).

In this example, if apple or orange were found they would not be included because curly braces were used. To make apple and orange match in the search, you would use square brackets. That is, fruit:[Apple TO Orange].

Fuzzy Searches

You can perform fuzzy searches by using the ~ character at the end of a single term. For example, searching for foam~ would match terms like foam or roams.

Proximity Searches

You can perform a proximity search by using the ~ character at the end of phrases. In a previous example I said that "Recite CMS" would find documents that have that exact phrase. On the other hand, if you want those words only to be near each other, you can use a proximity search.

For example, if you search for "Recite CMS"~5, then the two words much appear within 5 words of each other.

Term Boosting

You can boost the relevance of a term within your search by using the ^ character followed by a number.

By default, all terms have a boost factor of 1. If you wanted to search for Recite CMS, but you want the term Recite to have greater importance, change the term to Recite^2 CMS.

Boolean Operators

You can separate terms using the AND, OR or NOT keywords. For example, you can search for Recite AND CMS (must have both terms), Recite OR CMS (must have at least one of the terms), or Recite AND NOT CMS (must have Recite but mustn't have CMS).