Proximity Search Operators
You can apply proximity operators to words, exact phrases, or Boolean expressions to perform a proximity search. Note the following details:
-
If the two specified words are adjacent to each other, their proximity is 1. If one word separates them, their distance is 2, and so on.
-
Proximity operators do not count stop words. For example, because and is a stop word, the terms cat and dog have the proximity 1 in the text:
-
catdog
-
cat and dog.
-
-
The IDOL Content component uses APCM (Adaptive Probabilistic Concept Modeling) to rank results.
-
Proximity operators work recursively so that nested Boolean queries can have proximity operators apply to brackets or phrases. For example, in the expression
(term1) NEAR10 ((term2) DNEAR2 (term3))
the
NEAR10
operator ensures that term1 is in proximity to an occurrence of term2 within two of term3.
Operator | Explanation |
---|---|
NEARN
|
Returns only documents in which the second term is within action=Query&Text=red+NEAR1+green This query returns only documents in which the term red is adjacent to the term green. For example, documents that contain red green or green red return. Documents that contain red orange green do not return (because the terms are not close enough to each other). |
DNEARN
|
Directed action=Query&Text=red+DNEAR2+green This query returns only documents in which the term green follows the term red, and is no more than |
WNEARN
|
Weighted action=Query&Text=dog+WNEAR7+cat This query returns documents that contain either dog or cat. It gives extra relevance to documents in which dog and cat appear seven or fewer words apart in a piece of text. This weight increases as the terms get closer to each other. Documents in which the terms occur more than seven words apart, or in which only one term occurs, return with normal relevance. |
YNEARN
|
Weighted action=Query&Text=dog+YNEAR7+cat This query returns documents that contain both dog and cat. It gives extra relevance to documents in which dog and cat appear seven or fewer words apart in a piece of text. This weight increases as the terms get closer to each other. Documents in which the terms occur more than seven words apart return with the normal relevance. |
BEFORE
|
Returns only documents in which the first term precedes the second one. For example: action=Query&Text=red+BEFORE+green This query returns only documents in which the term green appears later than the term red. You can also use |
AFTER
|
Returns only documents in which the first term appears later than the second one. For example: action=Query&Text=red+AFTER+green This query returns only documents in which the term red appears later than the term green. You can also use |
XNEAR
|
Returns only documents in which the second term is exactly N words from the first term. For example: action=Query&Text=cats+XNEAR2+dogs This query returns only documents in which the term dogs follows the term cats and is exactly two words away from the term cats. This means that documents which contain cats and dogs return, but documents that contain dogs and cats or cats, dogs do not return. |
SENTENCE
|
Returns only documents in which the second term is in the same sentence as the first term. For example: action=Query&Text=cats+SENTENCE+dogs This query returns only documents in which the term dogs appears in the same sentence as the word cats. The IDOL Content component breaks the document into sentences by using a number of criteria. The most important criteria is the detection of an end of sentence marker, which includes a period (.), question mark (?), or exclamation point (!), as well as their multibyte variants. However, the presence of one of these characters is not always sufficient to mark the end of a sentence, because these characters are often used in abbreviations, names, and other items for purposes other than the end of a sentence. To locate a more accurate sentence boundary, Content also uses characteristics such as capitalization and syntactic observations. |
SENTENCENN
|
Returns only documents in which the second term is in the same sentence as the first term, and they are within action=Query&Text=cats+SENTENCE10+dogs This query returns only documents in which the term dogs occurs in the same sentence as, and within 10 words of, the word cats. NOTE: |
DSENTENCE
|
Returns only documents in which the second term occurs later than the first term, in the same sentence. For example: action=Query&Text=cats+DSENTENCE+dogs This query returns only documents in which the term dogs occurs later than the word cats, in the same sentence. |
DSENTENCENN
|
Returns only documents in which the second term occurs later than the first term, and within action=Query&Text=cats+DSENTENCE10+dogs This query returns only documents in which the term dogs occurs later in the same sentence than, and within 10 words of, the word cats. NOTE: |
PARAGRAPH
|
Returns only documents in which the second term is in the same paragraph as the first term. For example: action=Query&Text=red+PARAGRAPH+green This query returns only documents in which the term green appears in the same paragraph as the word red. The words do not have to be in the same sentence in the paragraph. |
PARAGRAPHNN
|
Returns only documents in which the second term is in the same paragraph as the first term, and they are within action=Query&Text=cats+PARAGRAPH20+dogs This query returns only documents in which the term dogs occurs in the same paragraph as, and within 20 words of, the word cats. NOTE: |