|
You can search for any word or phrase on a Web site by typing the word or phrase into a query form and clicking the button to execute the query (for example, the Execute Query button on the sample query form). This section covers the following topics:
- Boolean and Proximity Operators: Shows how to make more precise queries by inserting Boolean and proximity operators.
- Wildcards: Helps you find pages containing words similar to a given word.
- Free-Text Queries: Describes how to formulate a query based on the meaning of a phrase rather than the exact wording.
- Vector Space Queries: Explains how to get query results that match a list of words and phrases.
- Query Examples: Gives examples of various queries.
Searches produce a list of files that contain the word or phrase no matter where they appear in the text. This list gives the rules for formulating queries:
- Consecutive words are treated as a phrase; they must appear in the same order within a matching document.
- Queries are case-insensitive, so you can type your query in uppercase or lowercase.
- You can search for any word except for those in the exception list (for English, this includes a, an, and, as, and other common words), which are ignored during a search.
- Words in the exception list are treated as placeholders in phrase and proximity queries. For example, if you searched for Word for Windows, the results could give you Word for Windows and Word and Windows, because for is a noise word and appears in the exception list.
- Punctuation marks such as the period (.), colon (:), semicolon (;), and comma (,) are ignored during a search.
- To use specially treated characters such as &, |, ^, #, @, $, (, ), in a query, enclose your query in quotation marks ().
- To search for a word or phrase containing quotation marks, enclose the entire phrase in quotation marks and then double the quotation marks around the word or words you want to surround with quotes. For example, World-Wide Web or Web searches for World-Wide Web or Web.
- You can insert Boolean operators (AND, OR, and NOT) and the proximity operator (NEAR) to specify additional search information.
- The wildcard character (*) can match words with a given prefix. The query esc* matches the terms ESC, escape,
and so on.
- Free-text queries can be specified without regard to query syntax.
- Vector space queries can be specified.
- ActiveX (OLE) and file attribute property value queries can be issued.
Boolean and proximity operators can create a more precise query.
| To Search For |
Example |
Results |
| Both terms in the same page |
access and basic
Or
access & basic |
Pages with both the words access and
basic |
| Either term in a page |
cgi or isapi
Or
cgi | isapi |
Pages with the words cgi or isapi |
| The first term without the second term |
access and not basic
Or
access & ! basic |
Pages with the word access but not basic |
| Pages not matching a property value |
not @size = 100
Or
! @size = 100 |
Pages that are not 100 bytes |
| Both terms in the same page, close together |
excel near project
Or
excel ~ project |
Pages with the word excel near the word
project |
Hints:
- You can add parentheses to nest expressions within a query. The expressions in parentheses are evaluated before the
rest of the query.
- Use double quotes () to indicate that a Boolean or NEAR operator keyword should be ignored in your query. For
example, Abbott and Costello will match pages with the phrase, not pages that match the Boolean expression. In
addition to being an operator, the word and is a noise word in English.
- The NEAR operator is similar to the AND operator in that NEAR returns a match if both words being searched for are in the same page. However, the NEAR operator differs from AND because the rank assigned by NEAR depends on the proximity of words. That is, the rank of a page with the searched-for words closer together is greater than or
equal to the rank of a page where the words are farther apart. If the searched-for words are more than 50 words apart, they are not considered near enough, and the page is assigned a rank of zero.
- The NOT operator can be used only after an AND operator in content queries; it can be used only to exclude pages
that match a previous content restriction. For property value queries, the NOT operator can be used apart from the
AND operator.
- The AND operator has a higher precedence than OR. For example, the first three queries are equal, but the fourth is
not:a AND b OR c
c OR a AND b
c OR (a AND b)
(c OR a) AND b
Note The symbols (&, |, !, ~) and the English keywords AND, OR, NOT, and NEAR work the same way in all languages
supported by Index Server. Localized keywords are also available when the browser locale is set to one of the following six
languages:
| Language |
Keywords |
| German |
UND, ODER, NICHT, NAH |
| French |
ET, OU, SANS, PRES |
| Spanish |
Y, O, NO, CERCA |
| Dutch |
EN, OF, NIET, NABIJ |
| Swedish |
OCH, ELLER, INTE, NÄRA |
| Italian | E, O, NO, VICINO |
Note The NEAR operator can be applied only to words or phrases.
Wildcard operators help you find pages containing words similar to a given word.
The query engine finds pages that best match the words and phrases in a free-text query. This is done by automatically finding pages that match the meaning, not the exact wording, of the query. Boolean, proximity, and wildcard operators are ignored within a free-text query. Free-text queries are prefixed with $contents.
The query engine supports vector space queries. Vector queries return pages that match a list of words and phrases. The rank of each page indicates how well the page matched the query.
| To Search For |
Example |
Results |
| Pages that contain specific words |
light, bulb |
Files with words that best match the words
being searched for |
| Pages that contain weighted prefixes, words,
and phrases |
invent*, light[50], bulb[10],
"light bulb"[400] |
Files that contain words prefixed by invent,
the words light, bulb, and the phrase
light bulb (the terms are weighted) |
- Components in vector queries are separated by commas.
- Components in vector queries can be weighted by using the [weight] syntax.
- Pages returned by vector queries do not necessarily match every term in the query.
- Vector queries work best when the results are sorted by rank.
Regular expressions in property queries are defined as follows:
- Any character except asterisk (*), period (.), question mark (?), and vertical bar (|) defaults to matching just itself.
- Regular expressions can be enclosed in matching quotes (), and must be enclosed in quotes if they contain a space ( )
or closing parenthesis ()).
- The characters *, ., and ? behave as they behave in Windows; they match any number of characters, match (.) or end
of string, and match any one character, respectively.
- The character | is an escape character. After |, the following characters have special meaning:
( opens a group. Must be followed by a matching ). ) closes a group. Must be preceded by a matching (.
[ opens a character class. Must be followed by a matching (un-escaped) ].
{ opens a counted match. Must be followed by a matching }.
} closes a counted match. Must be preceded by a matching {.
, separates OR clauses.
* matches zero or more occurrences of the preceding expression. ?
matches zero or one occurrences of the preceding expression.
+ matches one or more occurrences of the preceding expression.
Anything else, including |, matches itself.
- Between square brackets ([]) the following characters have special meaning:
^ matches everything but following classes. Must be the first character.
] matches ]. May only be preceded by ^, otherwise it closes the class.
- range operator. Preceded and followed by normal characters.
Anything else matches itself (or begins or ends a range at itself).
- Between curly braces ({}) the following syntax applies:
|{m|} matches exactly m occurrences of the preceding expression. (0 < m < 256).
|{m,|} matches at least m occurrences of the preceding expression. (1 < m < 256).
|{m,n|} matches between m and n occurrences of the preceding expression, inclusive. (0 < m < 256, 0 < n <
256).
- To match *, ., and ?, enclose them in brackets (for example, |[*]sample will match *sample).
| Example |
Results |
@size > 1000000 |
Pages larger than one million bytes |
@write > 95/12/23 |
Pages modified after the date |
Apple tree |
Pages with the phrase apple tree |
"apple tree" |
Same as above |
@contents apple tree |
Same as above |
Microsoft and @size > 1000000 |
Pages with the word Microsoft that are larger than one million bytes |
"microsoft and @size > 1000000" |
Pages with the phrase specified (not the same as above) |
#filename *.avi |
Video files (the # prefix is used because the query contains a regular expression) |
@attrib ^s 32 |
Pages with the archive attribute bit on |
@docauthor = John Smith |
Pages with the given author |
$contents why is the sky blue? |
Pages that match the query |
@size < 100 & #filename *.gif |
Graphics Interchange Format (GIF) files less than 100 bytes in size |
|