This page contains a description of all the properties of the IndexingOptions class. The UpdateOptions class used for updating an index has the same properties. The properties that both classes inherit from the BaseOptions class are linked to that class.
Cancellation property
The Cancellation property is used to specify an object of type Cancellation, used to cancel an index operation. The default value of the Cancellation property is null. An operation can be cancelled at once with the Cancel method or after a time period with the CancelAfter method. Note that after cancellation, an index may stop an operation with some delay.
A document whose indexing was interrupted by cancellation remains in the index marked with the IndexedWithError flag. The next update of the index indexes such a document again. Documents added from streams, structures or extracted data cannot be indexed again by an update and have to be added again.
The following example demonstrates cancelling of an indexing operation.
C#
stringindexFolder=@"c:\MyIndex\";stringdocumentFolder=@"c:\MyDocuments\";// Creating an index in the specified folderIndexindex=newIndex(indexFolder);// Creating an instance of indexing optionsIndexingOptionsoptions=newIndexingOptions();options.Cancellation=newCancellation();// Setting a cancellation objectoptions.Cancellation.CancelAfter(300000);// Setting a time period of 300 seconds after which the indexing operation will be cancelled// Indexing documents from the specified folderindex.Add(documentFolder,options);
IsAsync property
The IsAsync property is used to specify whether to perform indexing operation asynchronously or synchronously. The default value is false, meaning synchronous execution. The example below demonstrates the performing of an asynchronous indexing.
C#
stringindexFolder=@"c:\MyIndex\";stringdocumentFolder=@"c:\MyDocuments\";// Creating index in the specified folderIndexindex=newIndex(indexFolder);// Subscribing to the eventindex.Events.StatusChanged+=(sender,args)=>{if(args.Status==IndexStatus.Ready||args.Status==IndexStatus.Failed){// A notification of the operation completion should be here}};// Creating an instance of indexing optionsIndexingOptionsoptions=newIndexingOptions();options.IsAsync=true;// Specifying the asynchronous performing of the operation// Indexing documents from the specified folder// The method will return control before the indexing operation is completedindex.Add(documentFolder,options);
AutoDetectEncoding property
The AutoDetectEncoding property is a flag that allows you to automatically detect the following encodings of text files during indexing: UTF-32 LE, UTF-32 BE, UTF-16 LE, UTF-16 BE, UTF-8, UTF-7. By default, the encoding auto detection of text files is disabled. But in any case, the encoding of a text file can be set during indexing when the FileIndexing event is raised. Detailed information on detecting and setting the encoding of text files is presented on the page Text file encoding detection.
Encoding property
The Encoding property specifies the encoding used to extract text from text files. The default value is null, which means that the default encoding UTF-8 is used. If AutoDetectEncoding is true then value of this property is used as the default encoding.
Threads property
The Threads property is used to set the number of threads used for indexing. The default value is 1. The number of indexing threads cannot be less than 1 or more than 4.
A larger number of threads accelerates the indexing process. However, be careful when specifying the number of indexing threads more than 1, because the amount of memory used during indexing is directly proportional to the number of threads involved. If there is 4 GB of RAM or less in the system, using more than 1 thread may result in out of memory error. In addition, the hard disk where the files for indexing are located may be the bottleneck and performance will not increase.
The following example demonstrates how to perform indexing in 2 threads.
C#
stringindexFolder=@"c:\MyIndex\";stringdocumentFolder=@"c:\MyDocuments\";// Creating an index in the specified folderIndexindex=newIndex(indexFolder);// Creating an instance of indexing optionsIndexingOptionsoptions=newIndexingOptions();options.Threads=2;// Setting the number of indexing threads// Indexing documents from the specified folderindex.Add(documentFolder,options);
SeparateProcessOptions property
The SeparateProcessOptions property is represented by an object of the SeparateProcessOptions class. This class contains properties for extracting data from documents in a separate process:
The ExtractInSeparateProcess property sets a value indicating whether a separate process is used to extract data from documents. The default value is false. When it is enabled, data are extracted in one thread, and the Threads property is ignored.
The Timeout property sets the maximum time to wait for the result of data extraction in a separate process. The default value is 10 minutes.
The AssemblyPath property sets the path to the assembly of the separate process.
The UseDotnetToStartProcess property sets a value indicating whether dotnet is used to start the process. The default value is true. Set it to false to start a self-contained application. On .NET Framework, dotnet is never used.
The UseRawTextExtraction property allows you to specify a value indicating whether to use raw text extraction mode whenever possible during indexing. The raw text extraction mode can significantly speed up the indexing process at the cost of losing the formatting quality of the extracted text. The default value for this property is false.
UseBackupPrivilege property
The UseBackupPrivilege property allows you to specify whether the process should use the backup privilege to access files and directories. When set to true, this property allows the process to bypass file and directory security checks, permitting access to protected resources typically restricted by ACLs, as long as the process has the proper privileges. Use this property with caution, as it may allow access to sensitive system files and user data.
This feature is only supported on Windows operating systems. On non-Windows platforms,
enabling this property has no effect.
Note that this requires the process to be running with administrative rights.
The IndexingEmptyValues property sets a value indicating whether to index empty field values or not. The default value is true.
The IndexingEmptyNames property sets a value indicating whether to index empty field names or not. The default value is true.
The DefaultFieldName property sets the default field name used to index empty field names. The default value is “unknown”.
The SeparatorInCompoundName property sets the separator in the compound name of a field. The default value is “.” (period character).
The MaxBytesToIndexField property sets the maximum number of values indexed from an array of byte values. The default value is int.MaxValue.
The MaxIntsToIndexField property sets the maximum number of values indexed from an array of int values. The default value is int.MaxValue.
The MaxLongsToIndexField property sets the maximum number of values indexed from an array of long values. The default value is int.MaxValue.
The MaxDoublesToIndexField property sets the maximum number of values indexed from an array of double values. The default value is int.MaxValue.
The SeparatorBetweenValues property sets the separator between values in a field of type array. The default value is " " (space character).
The following example demonstrates how to set the metadata indexing options.
C#
stringindexFolder=@"c:\MyIndex";stringdocumentFolder=@"c:\MyDocuments";// Creating an indexIndexindex=newIndex(indexFolder);// Setting the metadata indexing optionsvaroptions=newIndexingOptions();options.MetadataIndexingOptions.DefaultFieldName="default";options.MetadataIndexingOptions.SeparatorInCompoundName=@"\";options.MetadataIndexingOptions.MaxBytesToIndexField=10;options.MetadataIndexingOptions.MaxIntsToIndexField=10;options.MetadataIndexingOptions.MaxLongsToIndexField=10;options.MetadataIndexingOptions.MaxDoublesToIndexField=10;// Starting indexing operationindex.Add(documentFolder,options);
OcrIndexingOptions property
The OcrIndexingOptions property is represented by an object of the OcrIndexingOptions class. This class contains properties for setting OCR processing options:
The EnabledForSeparateImages property sets a value indicating whether to recognize text in separate image files. The default value is false.
The EnabledForEmbeddedImages property sets a value indicating whether to recognize text in embedded images. The default value is false.
The EnabledForContainerItemImages property sets a value indicating whether to recognize text in images that are items in a container (ZIP archive, OST/PST storage). The default value is false.
The OcrConnector property sets an OCR connector that is used for OCR processing. The default value is null, which means no OCR is used.
ImageIndexingOptions property
The ImageIndexingOptions property is represented by an object of the ImageIndexingOptions class. This class provides image indexing options for reverse image search:
The EnabledForSeparateImages property sets a value indicating whether to index separate image files. The default value is false.
The EnabledForEmbeddedImages property sets a value indicating whether to index embedded images (for example, images in a DOCX document). The default value is false.
The EnabledForContainerItemImages property sets a value indicating whether to index images that are items in a container (ZIP archive, OST/PST storage). The default value is false.
More resources
GitHub examples
You may easily run the code from documentation articles and see the features in action in our GitHub examples: