|
Logical operators combine the terms in a query expression. All single words and phrases may be combined with logical operators.
| Operator |
Syntax |
Description |
| AND |
term&term term and term |
Returns documents that contain one term and another. Returns the minimum score of its operands. All query terms must occur; lower score taken |
| OR |
term|term term or term |
Returns documents that contain one term or another. Returns the maximum score of its operands. At least one term must exist; higher score taken |
| ACCUMULATE |
term,term term accum term |
Returns documents that contain one term or another. Calculates score by adding its operands. Similar to OR, but if terms co-exist, score is combined |
| EQUIVALENCE |
term=term term equiv term |
Used to specify acceptable substitutions of words in a search. |
| MINUS |
term-term term minus term |
Returns the score of the right query term subtracted from the score of the left query term. |
| NOT |
term~term term not term |
Returns documents that contain one term and not another. |
ATTENTION: If any symbols or word equivalents for the logical operators are to be included as search terms in the query expression rather than used as operators, the symbols/words must be escaped by enclosing them in braces { }. The following examples illustrate how a phrase containing a operator symbol or equivalent can be queried:
'sense {and} sensibility'
'{peter, paul, and mary}'
'{pride & prejudice}'
AND QUERIES:
Use the AND operator to search for documents that contain at least one occurrence of each of the query terms. For example:
'batman & robin & penguin'
'jupiter and ganymede'
OR QUERIES:
Use the OR operator to search for documents that contain at least one occurrence of any of the query terms. For example:
'cats | dogs'
'california or oregon'
ACCUMULATE QUERIES:
Use the ACCUMULATE operator to search for documents that contain at least one occurrence of any of the query terms. For example:
'cat, dog, horse'
'california accum election accum convention'
ACCUMULATE is similar to OR, in the sense that a document satisfies the query expression if any of the terms occur in the document; however, the scoring is different.
OR returns a score based only on the query term that occurs most frequently in a document. ACCUMULATE combines the scores for all the query terms that occur in a document.
EQUIVALENCE QUERIES:
Use the equivalence operator to specify an acceptable substitution for a word in a search. For example, if you want all the documents that contain the phrase alsatians are big dogs or labradors are big dogs, you can write:
'labradors=alsatians are big dogs'
Server processes the above query faster and more efficiently than the same query written with the accumulate operator. For example, you could write the above query less efficiently and less concisely as follows:
'labradors are big dogs, alsatians are big dogs'
The savings you gain in using the equivalence operator over the accumulate operator is most significant when you have more than one equivalence operator in the query expression. For example, the following query
'labradors=alsatians are big canines=dogs'
is a more efficient, more concise form of:
'labradors are big dogs,
alsatians are big dogs'
alsatians are big canines'
labradors are big canines'
MINUS QUERIES:
Use the MINUS operator to search for documents that contain at least one occurrence of each of the query terms. For example:
'poisons - arsenic'
'swimming minus sharks'
MINUS is similar to AND in the sense that a document satisfies the query expression only if both terms occur in the document; however, the scoring is different. AND returns a score based on the intersection of the two query terms. MINUS returns a score which is calculated by subtracting the number of occurrences of the second query term from the number of occurrences of the first term.
NOT QUERIES:
Use the NOT operator to search for documents that contain one query term and not another.
For example, to obtain the documents that contain the term animals but not dogs, use the following expression:
'animals ~ dogs'
Similarly, to obtain the documents that contain the term transportation but not automobiles or trains, use the following expression:
'transportation not (automobiles or trains)'
Note: The NOT operator does not affect the scoring produced by the other logical operators.
WILDCARD CHARACTERSWildcard characters can be used in query expressions to expand word searches into pattern searches. The wildcard characters are:
percent ( % )
underscore (_)
The percent wildcard specifies that any characters may appear in multiple positions represented by the wildcard. The underscore wildcard specifies a single position in which any character may occur.
|