dtSearch Text Retrieval Engine Programmer's Reference
Search Requests Overview

Overview of search request topics

A search request may include any combination of: (1) a full text search request, (2) restrictions based on the filename, modification date, or size, and (3) additional boolean restrictions, such as criteria based on the contents of fields in user documents. To accommodate these types of searching, dtSearch can combine three separate string values to form the complete search request. 

The maximum total size of a search request in bytes is dtsMaxSearchRequestLen, which is defined in dtsearch.h. 


The Request string usually comes from user input. Depending on the value of the search flags, it can use the boolean query syntax, or the "all words" or "any words" query syntax. 


File conditions are usually restrictions based on the file modification date, name, or size. File conditions use the xfilter syntax described in the "File Conditions" help topic. File conditions can also be used to optimize searches for terms or field values, because matches on file conditions do not generate "hits" in the search results, which enables dtSearch to ignore word location information. 


BooleanConditions are additional search criteria that are expressed in the boolean query syntax. BooleanConditions are useful when your application needs to combine a user-entered search request, which may be in the "all words" or "any words" syntax, with a boolean combination of field searches. 


A document is retrieved in a search only if it matches the Request, FileConditions, and BooleanConditions. If any of these items is blank, it is ignored. 

Search features such as fuzzy searching, stemming, wildcards, etc. can be used in any of the three search strings. 

In the developer API, the Request, FileConditions, and BooleanConditions are properties of the SearchJob or DSearchJob (C++). In dtSearch Web, these three strings are HTML form variables.

A web-based application is set up to search a collection of PDF files. The application must be able to provide full-text search using the "any words" query syntax, as well as date range searching. Additionally, users can enter keywords to search for in the "Author" and "Subject" fields of the PDF files. 

To implement this type of searching, the application would do the following:

  1. Store the user-entered search request in the Request member of the SearchJob.
  2. Set SearchJob.SearchFlags to dtsSearchAnyWords, specifying the query syntax of the request.
  3. Format the user's date range, if any, using the xfilter syntax, and store it in the FileConditions member of the SearchJob.
  4. If the user specified keywords for the Author or Subject fields, add them in the BooleanConditions member of the SearchJob.

For example, suppose a user is searching for a 2001 document on tax policy that concerns annuities and life insurance. The user fills out the search form as follows:

Search request: +"life insurance" +annuities Subject: tax Date: January 2001 - December 2001

The application would set up a search as follows:

Request: +"life insurance" +annuities BooleanConditions: (Subject contains (tax)) FileConditions: xfilter(date "M01/D01/Y2001~~M12/D31/Y2001")