You are here: Overviews > Search Requests > Boolean Search Requests
Close
dtSearch Text Retrieval Engine Programmer's Reference
Boolean Search Requests

Boolean search request syntax

dtSearch supports two types of search requests: 

An any words or "natural language" search is any sequence of text, like a sentence or a question. In an "any words" search, use quotation marks around phrases, put + in front of any word or phrase that is required, and - in front of a word or phrase to exclude it. Examples:

banana pear "apple pie" "apple pie" -salad +"ice cream"

A boolean search request consists of a group of words, phrases, or macros linked by connectors such as AND and OR that indicate the relationship between them. Examples:

Search Request
Explanation
apple and pear
Both words must be present.
apple or pear
Either word can be present.
apple w/5 pear
Apple must occur within 5 words of pear.
apple pre/5 pear
Apple must occur 5 or fewer words before pear.
apple not w/5 pear
Apple must not occur within 5 words of pear.
apple and not pear
Only apple must be present.
name contains smith
The field name must contain smith
apple w/5 xfirstword
Apple must occur in the first five words.
apple w/5 xlastword
Apple must occur in the last five words.

If you use more than one connector, you should use parentheses to indicate precisely what you want to search for. For example, apple and pear or orange juice could mean (apple and pear) or orange, or it could mean apple and (pear or orange)

Noise words, such as if and the, are ignored in searches.

Copyright (c) 1995-2021 dtSearch Corp. All rights reserved.