Close
dtSearch Text Retrieval Engine Programmer's Reference
"All words" and "Any words" Searches

The "All words" and "Any words" syntaxes are alternatives to the default boolean syntax for dtSearch queries.

The default syntax for a dtSearch search request is boolean. dtSearch can also use an alternative syntax that is more like the syntax used on some internet search engines, with "all words" and "any words" search options. To specify that a search uses the alternative syntax, use the dtsSearchTypeAllWords or dtsSearchTypeAnyWords search flag. 

The alternative syntax eliminates boolean connectors and instead lets users enter a search request as a list of words or quoted phrases. Example:

"first class mail" postage

In an "All Words" search, this would be equivalent to the boolean search

first class mail and postage

In an "Any Words" search, this would be equivalent to the boolean search

first class mail or postage

A plus in front of a word or phrase indicates that the word or phrase must be present, and a minus in front of a word or phrase indicates that the word may not be present. Example:

+"first class mail" +postage -meter

This would find any document that contains "postage" and "first class mail" but not "meter". 

"All words" and "any words" searches do not use boolean connectors, so the "contains" syntax for expressing field criteria cannot be used. Instead, add FieldName:: in front of each word, like this:

+Name::Smith +Address::California

This would find a document with "Smith" in the Name field and "California" in the Address field