Use to search indexes or to search without an index.
There are three components to the search request that can be included in a SearchJob:
(1) Request: The search request, which can be in the "boolean", "all words", or "anywords" syntax, depending on the value of SearchFlags.
(2) BooleanConditions: A string in the boolean syntax expressing any conditions that must be satisfied in addition to whatever is in Request. 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) FileConditions: A string expressing conditions such as filename matches, file size matches, etc., that documents must satisfy.
For information on the syntax for these values, see:
After a search, to obtain search results, use SearchJob.Results to create a SearchResults object with the documents that were found in the search.
To receive callbacks during a search with the name of each document as it is found, create an object that implements the ISearchStatusHandler interface and attach it to the SearchJob's StatusHandler.
To implement a "Cancel" button, start the search using ExecuteInThread and then use AbortThread to cancel the search.
In server applications, to limit the amount of time and resources a search can consume, use TimeoutSeconds, MaxFilesToRetrieve, and AutoStopLimit. For more information, see:
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 SearchFilter object with the filter to use, and call SearchJob.SetFilter to attach the filter to the SearchJob. Example:
To generate a search filter based on the results of a search, set WantResultsAsFilter to true. After the search, every document retrieved in the search will be selected in the output search filter, ResultsAsFilter. Note: MaxFilesToRetrieve does not affect outputSearchFilter, which will include everyitem 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 SearchFilter.
For more information, see: SearchFilter
When using the dtSearch Engine API, it is essential to use the IDisposable pattern with all API objects except JobErrorInfo. Otherwise, the .NET garbage collector may take a long time to free memory used by potentially large objects such as SearchResults, resulting in memory depletion in long-running applications. In C# code, use a "using" clause with dtSearch Engine API objects, and in other code call Dispose() when you are done with an object.