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 more information, see: Search Requests Overview
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.
In server applications, to limit the amount of time and resources a search can consume, use TimeoutSeconds, MaxFilesToRetrieve, and AutoStopLimit.
For more information, see: Limiting Searches.
A SearchFilter represents a set of documents that can be returned in a search. To limit a search to the documents in a SearchFilter, set up a SearchFilter object with the filter to use, and assign it to SearchJob.SearchFilter. Example:
To generate a search filter based on the results of a search, pass the SearchFilter to the SearchJob.Execute method, like this:
To optimize the search to generate a SearchFilter only, set the flag dtsSearchFastSearchFilterOnly in SearchJob.
After the search, every document retrieved in the search will be selected in the output search filter. The generated search filter can then be used to limit a subsequent search, which can be useful for implementing a "search within these results" feature.
SearchJob.MaxFilesToRetrieve does not affect the generated output SearchFilter, 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 SearchFilter.
For more information, see: Limiting searches with SearchFilters.
SearchJob, SearchResults, and SearchFilter all require the IDisposable Pattern.
Topic |
Description |
The following tables list the members exposed by JobBase. | |
The properties of the JobBase class are listed here. |
Topic |
Description |
The following tables list the members exposed by SearchJob. | |
The methods of the SearchJob class are listed here. | |
The properties of the SearchJob class are listed here. |
SearchJob Class |
Description |
Executes the search and returns when the search is complete. |
SearchJob Class |
Description |
Set to a non-zero value to make the search automatically stop when this many documents were found. | |
Additional boolean conditions that a document must meet to be retrieved in a search. | |
Filename filters to exclude documents from the search in an unindexed search. | |
Specify a relevance weight for hits that occur in listed fields (example: Subject:10,HtmlTitle:20) | |
File conditions that a document must meet to be retrieved in a search. | |
After a search, contains the number of files retrieved (this is the total number of documents matched, regardless of the MaxFilesToRetrieve setting). | |
In an unindexed search, the directories or files to search. | |
If non-zero, the engine will match words that are close to but not identical to a search term. | |
After a search, contains the number of hits in all files retrieved. | |
Filename filters to select documents to search in an unindexed search. | |
Use an IndexCache for this SearchJob | |
The full path of each index to search. | |
Limit the maximum size of search results to a specified number of files. | |
What to search for. | |
Apply a search filter to the search that can be used to exclude or permit specified documents to be returned in search results. | |
Flags controlling various search options. | |
Object to receive callback notifications when documents are found. | |
Flags controlling various search options. |
Copyright (c) 1998-2023 dtSearch Corp. All rights reserved.
|