dtSearch Text Retrieval Engine Programmer's Reference
dtsSearchJob Structure

Define a search to be performed.

File: dtsearch.h


A dtsSearchJob is used in the dtssDoSearchJob function call to define a search to be performed

Search criteria

There are three components to the search request that can be included in a dtsSearchJob: 

(1) request2: The search request, which can be in the "boolean", "all words", or "anywords" syntax, depending on the value of searchFlags2

(2) booleanConditions: A string in the boolean syntax expressing any conditions that must be satisfied in addition to whatever is in request2. This provides a way to add boolean conditions (such as field criteria) to a user-supplied query, which may be in the all words or any words syntax. 

(3) fileConditions2: A string expressing conditions such as filename matches, file size matches, etc., that documents must satisfy. See FileConditions for the syntax.

Search results

Search results are obtained using a search results object. To set up a search job, declare a dtsSearchResults object to hold the results and then attach its handle to dtsSearchResults.resultsHandle. After the search, you can use the dtsSearchResults object to access the results of the search.

dtsSearchResults searchResults; dtsSearchJob searchJob; // ... set up searchJob ... searchJob.resultsHandle = searchResults.getHandle(); short errorFlag; dtssDoSearchJob(searchJob, errorFlag); // .. now searchResults contains the results of the search
Search filters

A search filter represents a set of documents that can be returned in a search. To limit a search to the documents in a search filter, set up a dtsSearchFilter object with the filter to use, and set dtsSearchResults.searchFilterHandle to the handled returned by dtsSearchFilter.getHandle(). Example: 


dtsSearchFilter searchFilter; // ... read searchFilter from disk, or generate it by searching, or set allowed values // directly using searchFilter.selectItems() ... dtsSearchJob searchJob; // ... set up searchJob ... searchJob.searchFilterHandle = searchFilter.getHandle(); // Now when searchJob is executed, only documents identified by searchFilter can be // retrieved.


To generate a search filter based on the results of a search, set the outputSearchFilterHandle to the handle of a dtsSearchFilter. Every document retrieved in the search will be selected in the output search filter. Note: maxFilesToRetrieve does not affect outputSearchFilter, which will include *every* item retrieved in the search. However, if autoStopLimit causes the search to terminate before it is complete, then only items found before the search stopped will be selected in the dtsSearchFilter.