Define a search to be performed.
struct dtsSearchJob : public dtsJobBase { char request[256]; char fileConditions[256]; struct dtsSearchJobAction action; struct dtsFileSpec filesToSearch; const char * indexesToSearch; long totalFiles; long totalHits; const char * request2; void * resultsHandle; const char * fileConditions2; dtsDataSource * dataSourceToSearch; long maxWordsToRetrieve; struct dtsRetrievedFileTable * resultsBuffer; short maxFilesToRetrieve; short unindexedSearchFlags; short searchFlags; short fuzziness; long autoStopLimit; long searchFlags2; dtsSearchFilterHandle searchFilterHandle; const char * booleanConditions; long maxFilesToRetrieve2; dtsSearchFilterHandle outputSearchFilterHandle; const char * fieldWeights; dtsIndexCacheHandle indexCacheHandle; };
dtsearch.h
A dtsSearchJob is used in the dtssDoSearchJob function call to define a search to be performed
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 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
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.
|
Data Member |
Description |
|
Type of search to perform. | |
|
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. | |
|
In an unindexed search, the contents of the dtsDataSource will be searched along with any files specified by filesToSearch. | |
|
Specify a relevance weight for hits that occur in listed fields (example: Subject:10,HtmlTitle:20) | |
|
Deprecated; use fileConditions2 | |
|
In an indexed search, filename, date, or size criteria that a file must meet to be retrieved. | |
|
Identifies files to search in an *unindexed search only | |
|
If non-zero, the engine will match words that are close to but not identical to a search term. | |
|
Optional handle to a dtsIndexCache to use for faster high-volume searching | |
|
Null-delimited string set identifying indexes to search. | |
|
Obsolete -- use maxFilesToRetrieve2; | |
|
Limit the maximum size of search results to a specified number of files. | |
|
A per-search override to the dtsOptions.maxWordsToRetrieve setting | |
|
A search filter to hold the results of the search (possibly in addition to resultsHandle). | |
|
Deprecated: use request2 | |
|
A null-terminated string containing the search request. | |
|
Obsolete | |
|
Handle of a dtsSearchResults to store the results of this search. | |
|
Handle to a dtsSearchFilter to use to limit the documents that can be retrieved in this search. | |
|
Obsolete -- use searchFlags2 | |
|
SearchFlags values controlling various search options | |
|
Following a search, contains the number of files retrieved | |
|
Following a search, contains the number of hits retrieved in all files. | |
|
UnindexedSearchFlags values controlling an unindexed search |
|
Data Member |
|
Method |
|
Copyright (c) 1995-2012 dtSearch Corp. All rights reserved.
|