This page contains a description of all index settings that can be specified in an instance of the IndexSettings class.
An index settings object is passed to an Index constructor when a new index is created. The settings are saved in the index. When an existing index is opened, it uses the settings saved in it; only the CustomExtractors and Logger settings, which are not saved, are taken from the passed settings object. The settings of an opened index are available through the Index.IndexSettings property.
Some settings define how the text of documents is divided into terms, so they cannot be changed freely after the index is created:
The CustomExtractors property returns a collection of custom text extractors that allows adding new extractors for supported or not supported formats. Custom extractors are not saved in an index, so they must be added each time the index is created or opened. A complete example of implementing a custom text extractor and using it to extract text is presented on the page Custom text extractors.
DocumentFilter property
The DocumentFilter property allows you to set a filter used to determine whether files being added to the index should be indexed. If a document added separately or located in an added folder does not match the filter, it is not indexed. The default value is null, which means that all added files will be indexed if their format is supported. The value can be changed at any time. Detailed information on creating and setting the document indexing filter can be found on the page Document filtering during indexing.
IndexType property
The IndexType property is used to specify the type of an index. The IndexType enumeration contains 3 values:
NormalIndex - the type of an index containing the content and metadata of the added documents. It supports all search features.
MetadataIndex - the type of an index containing only metadata of added documents. It supports all search features. An example of creating an index of this type is presented on the Indexing metadata of documents page.
CompactIndex - the type of an index containing the content and metadata of the added documents. It takes much less disk space, but does not support the phrase search and the date range search features.
The default value of this property is NormalIndex. The index type is fixed when the index is created.
InMemoryIndex property
The read-only property InMemoryIndex returns a value indicating whether an index is located in RAM or on disk. The value of this property is set indirectly when creating or loading an index. An index is created on disk when the path to the index folder is specified; otherwise, an index is created in memory. See the Search index location page for details.
Logger property
The Logger property allows you to specify in the index settings the logger used for logging index events and errors during its operation. The default value is null meaning that logging is not used. The logger is not saved in an index, so it must be assigned each time the index is created or opened. Detailed information on creating and assigning an index logger and the implementation of a custom logger is presented on the page Logging.
MaxIndexingReportCount property
The MaxIndexingReportCount property allows you to specify the maximum number of indexing reports stored in RAM for an index since it was created or loaded. The default value is 5. Detailed information on indexing reports is provided on the page Indexing reports.
MaxSearchReportCount property
The MaxSearchReportCount property allows you to specify the maximum number of search reports stored in RAM for an index since it was created or loaded. The default value is 10. Detailed information on search reports is provided on the page Search reports.
ReplaceUnpairedSurrogates property
The ReplaceUnpairedSurrogates property specifies how unpaired UTF-16 surrogate characters in the text of documents are processed during indexing. If the value is true, each unpaired surrogate character is replaced with the Unicode replacement character (U+FFFD), so the characters around it are not joined into a single term. If the value is false, unpaired surrogate characters are removed, as previous versions did.
The default value is true. The setting is fixed when the index is created. An index updated from a version earlier than 26.10 has this setting disabled.
SearchThreads property
The SearchThreads property allows you to set the number of threads used to search in an index. By default, this value is NumberOfThreads.Default, which means that the search is performed using as many threads as there are processor cores. This number of threads ensures the optimal speed of each individual search in an index. If you plan a large number of parallel search queries and you need to ensure maximum total search performance, you should set the NumberOfThreads.One value for this property.
The value can be changed at any time, also for an existing index through the Index.IndexSettings property. A search uses the value that is set when the search starts, and the new value is saved in the index. The setter throws ArgumentOutOfRangeException if the value is not a member of the NumberOfThreads enumeration.
In a multithreaded search, the order of the words found by a regular expression, numeric range, fuzzy or spelling correction search may differ from run to run. If you need a deterministic order of the results, use the NumberOfThreads.One value.
The following example demonstrates how to change the number of search threads of an existing index.
C#
stringindexFolder=@"c:\MyIndex\";stringquery="Einstein";// Opening an existing indexIndexindex=newIndex(indexFolder);// Changing the number of threads used for the search; the new value is saved in the indexindex.IndexSettings.SearchThreads=NumberOfThreads.One;// Searching using the new number of threadsSearchResultresult=index.Search(query);
SkipBlendedOnlyTerms property
The SkipBlendedOnlyTerms property specifies whether terms that consist only of blended characters are skipped during indexing. For example, if the hyphen is a blended character, a standalone hyphen in the text is not indexed as a term when the value is true. This reduces the number of meaningless terms in the index.
The default value is true. The setting is fixed when the index is created. An index updated from a version earlier than 26.10 has this setting disabled.
The following example demonstrates how to create an index that keeps the terms consisting only of blended characters.
C#
stringindexFolder=@"c:\MyIndex\";stringdocumentsFolder=@"c:\MyDocuments\";// Creating index settingsIndexSettingssettings=newIndexSettings();settings.SkipBlendedOnlyTerms=false;// Keeping the terms consisting only of blended characters// Creating an index with the specified settingsIndexindex=newIndex(indexFolder,settings,true);// Indexing documents from the specified folderindex.Add(documentsFolder);
TextStorageSettings property
The TextStorageSettings property allows you to specify the settings for saving the text of indexed documents in an index. The default value is null, which means that document texts are not stored. The setting is fixed when the index is created. Detailed information on saving the text of indexed documents in an index is presented on the page Storing text of indexed documents.
UseCharacterReplacements property
The UseCharacterReplacements property allows you to set the value indicating whether to perform character replacements during the indexing process or not. The default value is false. The value can be changed only while the index contains no documents and is not performing an operation; otherwise, InvalidOperationException is thrown. Details on replacing characters during indexing are provided on the page Character replacement during indexing.
UseStopWords property
The UseStopWords property allows you to specify a value indicating whether to use stop words during indexing or not. Stop words are frequently used words that do not carry a semantic load, which are removed from an index to reduce its size. The default value for this property is true. The value can be changed only while the index contains no documents and is not performing an operation; otherwise, InvalidOperationException is thrown. Detailed information on stop words and their use is presented on the page Indexing with stop words.
More resources
GitHub examples
You may easily run the code from documentation articles and see the features in action in our GitHub examples: