The IndexJob object handles creation and updating of dtSearch indexes.
To create or update an index, make an IndexJob, use the properties to describe the indexing task you want the engine to perform, and call the Execute method. IndexJob provides two ways to specify the text to be indexed: (1) the setIncludeFilters, setExcludeFilters, and setFoldersToIndex members let you specify directories and filename filters identifying a set of disk files to index, and (2) the DataSourceToIndex member lets you supply text data directly to the dtSearch Engine for indexing. dataSourceToIndex is useful for indexing data from non-file sources such as message stores, SQL databases, dynamically-generated data, or any non-file data accessible to your program.
The setActionXXX flags specify the actions you want the engine to perform. If more than one action is specified, the engine will perform the actions in the following order: create, removeDeleted, removeListed, add, compress, merge, verify.
A brief summary of the meaning of each actionXXX flag is given below. For more information, see "Building and Maintaining Indexes" in the Overviews section.
Add: Add documents to an existing index.
Compress: Remove obsolete information from the index.
Create: Create a new index. If an index already exists in the specified directory, the index will be destroyed and replaced with a new, empty index.
RemoveDeleted: Check that each file in the index still exists on disk and remove from the index any files that no longer exist.
RemoveListed: Remove the files listed in ToRemoveList from the index.
Merge: Merge one or more indexes into the target index. Use setIndexPath to specify the location of the target index, and setIndexesToMerge to specify the location of the indexes to merge. Merging indexes combines two or more indexes into a single index, which contains any document that was in any of the merged indexes. If the same document appears in more than one of the merged indexes, only the most recent document will appear in the merged index.
Verify: To verify an index, dtSearch scans all structures in the index and performs many detailed checks to validate all data in the index for consistency.
After executing an IndexJob, call getErrors() to check for any errors that may have occurred during the job.
Building and Maintaining Indexes in Overviews