The Index Server Query Language

When composing a query, we need to keep in mind a few simple rules:

Words separated by spaces or ordinary punctuation (which is not listed as a special character in the tables later in this section) are treated as a phrase. The search will only return documents that contain this phrase. However, words within the phrase which are listed in the noise list (such as a, as, and, but, for, etc.) are ignored completely. Matching is also case-insensitive. So searching for

the
State;
and
the
County
will also match
the
state
of
a
county
.

To search for a phrase that contains quotation marks, or one of the special characters such as an exclamation mark, we have to enclose the whole phrase in quotation marks, and then place double quotation marks where we want a quotation mark to appear. For example, "

he
yelled
""Hello!""
from
across
the
street"
. To search for several individual words in a document, we separate the words with a comma. The result will be documents that contain all, or only some, of the words listed. The more that match, however, the better the ranking of the result.

Other than that, we can use the normal wildcard and Boolean operators. An asterisk matches any number of characters, and a question mark matches any single character. There's also the option of a fuzzy search. Adding two asterisks to the end of a word will match 'stem words' with the same meaning. A search for

catch**
, for instance, will include catching and caught.

To combine words in the search string, we use Boolean operators like this:

Boolean Keywords Shorthand Meaning
Apples AND Pears
Apples
&
Pears
Both must exist in the document.
Apples OR Pears
Apples
|
Pears
Either must exist in the document.
Apples AND NOT Pears
Apples
&
!Pears
The first word must exist in the document, but the second must not.
Apples NEAR Pears
Apples
~
Pears
Both must exist in the document, and be within 50 words of each other. The closer they are, the higher the ranking in the search result.
NOT @size < 2049
!
@size
<
2049
Document must be larger than 2 KB.

© 1998 by Wrox Press. All rights reserved.