


You can perform a dtSearch using the search string Ryan AND NOT Will to query for these messages, and return results that does not include document AS00001. The following record illustrates these conditions: Document For example, you may want to query for email messages that have Ryan as the author, but do not have Will as the recipient. You can use the AND NOT operator to develop queries for documents that include the first expression but not the second expression. Note: You can also use NOT in a proximity search as illustrated by the NOT W/N (NOT Within N words) connector. For example, the search expression "apple OR NOT pear" returns all the documents that contain the word "apple" and those that do not contain the word "pear". When the NOT operator appears in the middle of a search expression, it must be used in conjunction with either AND or OR. The search expression "NOT (apple w/5 pear)" returns all the documents that do not contain the word "apple" within five words of "pear". For example, the search expression "NOT pear" returns all the documents that do not contain the word "pear". You can use the NOT operator by itself at the beginning of a search expression. For example, the search expression "applesauce and NOT pear" returns documents that contain the word "applesauce", but not those documents that contain both the words "applesauce" and "pear". In a dtSearch, you can use the NOT operator at the beginning of a search expression to negate its meaning, and exclude documents from a result set. For example, the search string "apple pie or poached pear" will return documents that contain "apple pie", "poached pear", or both phrases. When you use the OR operator to connect expressions in a search string, documents that contain one or more of these expressions will be returned in the result set. When you search for the string apple AndAny pear, documents 1 and 2 are returned.When you search for the string apple AND pear, only document 2 is returned.When you search for the term apple, documents 1 and 2 are returned.You have three documents, each containing the term(s) specified below: The following example further explains the AndAny operator: The AndAny terms are not evaluated as conditions, but are simply added to the search results. In other words, the AndAny operator doesn’t change the set of docs responsive for any optional terms coming to the right of the AndAny operator. If the document contains any or all of the terms that come after the AndAny connector but none of the terms that come before the AndAny connector, it will not be returned. For example, "(apple and pear) AndAny (grape or banana)" would find any document that contains "apple" and "pear," with "grape" and "banana" also being counted as hits only if "apple" and " pear" are also present in the document.Ī document is only returned if it contains at least the required search terms. The words before the AndAny connector are required, and the words after the AndAny connector are optional. You can combine a search for required search terms with other terms that are optional.

"(apple or banana) AND (pear w/5 grape)" retrieves any documents that contain "apple" or "banana" AND contain "pear" within five words of "grape"."apple pie AND poached pear" retrieves any documents that contain both phrases.
Dtsearch booleanconditions how to#
The following search strings illustrate how to use this operator: When you use the AND operator to connect expressions, only documents that contain all the expressions in the search string will be returned in the result set. You can use these operators to connector multiple phrases or terms in a single search expression.

The dtSearch engine supports Boolean operators, including AND, OR, and NOT. Reference Guides > Searching Guide > dtSearches > Boolean connectors Boolean connectors
