You are here: Symbol Reference > dtSearch.Engine Namespace > IndexJob Class
dtSearch .NET Standard API 2021.02
IndexJob Class

Create or update indexes

public class IndexJob : JobBase;

For more information on creating, updating, and maintaining indexes, see "Building and Maintaining Indexes" in dtSearchApiRef.chm. 

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 FoldersToIndex, IncludeFilters, and ExcludeFilters members let you specify directories and filename filters identifying a set of disk files to index, and (2) the DataSourceToIndex member lets you supply data directly to the dtSearch Engine for indexing, using an object that implements the DataSource interface. 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 Action 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, add, removeDeleted, removeListed, compress, merge, verify.


IndexJob requires the IDisposable Pattern.

Multithreaded Indexing

Set the flag dtsIndexMultithread in an IndexJob to build an index using multiple threads. Set IndexJob.ThreadCount to specify the number of threads to use. The engine will create the threads itself and return from the IndexJob once all of the threads are done. 

Index progress notifications will be sent from each thread so the handler for these notifications must be able to handle concurrent notifications from multiple threads. 

For indexes built with the DataSource API, a separate DataSource instance must be provided for each thread using DataSourceList. For example, if the thread count is 4, then the IndexJob must include 4 DataSource instances, one for each thread. For sample code demonstrating how to do this, see the FolderDataSource sample in dtSearch\examples\NetStd.


Multithreaded indexing is 64-bit only. 

The IndexJob setting AutoCommitIntervalMB does not apply to multithreaded index updates.

Copyright (c) 1998-2022 dtSearch Corp. All rights reserved.