public class IndexSettings extends Object
Learn more
The example demonstrates a typical usage of the class.
String indexFolder = "c:\\MyIndex\\";
IndexSettings settings = new IndexSettings();
settings.setIndexType(IndexType.CompactIndex); // Setting the index type
Index index = new Index(indexFolder, settings); // Creating an index
Constructor and Description |
---|
IndexSettings()
Initializes a new instance of the
IndexSettings class. |
Modifier and Type | Method and Description |
---|---|
boolean |
getAutoDetectEncoding()
Gets a value indicating whether to detect encoding automatically or not.
|
CustomExtractorCollection |
getCustomExtractors()
Gets the custom extractor collection.
|
DocumentFilter |
getDocumentFilter()
Gets a document filter.
|
IndexType |
getIndexType()
Gets the index type.
|
boolean |
getInMemoryIndex()
Gets a value indicating whether the index is stored in memory or on disk.
|
ILogger |
getLogger()
Gets a logger that is used for logging events and errors in the index.
|
int |
getMaxIndexingReportCount()
Gets the maximum number of indexing reports.
|
int |
getMaxSearchReportCount()
Gets the maximum number of search reports.
|
NumberOfThreads |
getSearchThreads()
Gets the number of threads used for the search.
|
TextStorageSettings |
getTextStorageSettings()
Gets the text storage settings.
|
boolean |
getUseCharacterReplacements()
Gets a value indicating whether to use character replacements or not.
|
boolean |
getUseRawTextExtraction()
Gets a value indicating whether the raw mode is used for text extraction if possible.
|
boolean |
getUseStopWords()
Gets a value indicating whether to use stop words or not.
|
protected static boolean |
isReadOnly(IndexSettings settings) |
void |
setAutoDetectEncoding(boolean value)
Sets a value indicating whether to detect encoding automatically or not.
|
void |
setDocumentFilter(DocumentFilter value)
Sets a document filter.
|
void |
setIndexType(IndexType value)
Sets the index type.
|
void |
setLogger(ILogger value)
Sets a logger that is used for logging events and errors in the index.
|
void |
setMaxIndexingReportCount(int value)
Sets the maximum number of indexing reports.
|
void |
setMaxSearchReportCount(int value)
Sets the maximum number of search reports.
|
void |
setSearchThreads(NumberOfThreads value)
Sets the number of threads used for the search.
|
void |
setTextStorageSettings(TextStorageSettings value)
Sets the text storage settings.
|
void |
setUseCharacterReplacements(boolean value)
Sets a value indicating whether to use character replacements or not.
|
void |
setUseRawTextExtraction(boolean value)
Sets a value indicating whether the raw mode is used for text extraction if possible.
|
void |
setUseStopWords(boolean value)
Sets a value indicating whether to use stop words or not.
|
public IndexSettings()
Initializes a new instance of the IndexSettings
class.
public final boolean getInMemoryIndex()
Gets a value indicating whether the index is stored in memory or on disk.
public final boolean getUseStopWords()
Gets a value indicating whether to use stop words or not.
The default value is true
.
public final void setUseStopWords(boolean value)
Sets a value indicating whether to use stop words or not.
The default value is true
.
value
- A value indicating whether to use stop words or not.public final int getMaxIndexingReportCount()
Gets the maximum number of indexing reports.
The default value is 5
.
public final void setMaxIndexingReportCount(int value)
Sets the maximum number of indexing reports.
The default value is 5
.
value
- The maximum number of indexing reports.public final int getMaxSearchReportCount()
Gets the maximum number of search reports.
The default value is 10
.
public final void setMaxSearchReportCount(int value)
Sets the maximum number of search reports.
The default value is 10
.
value
- The maximum number of search reports.public final boolean getUseCharacterReplacements()
Gets a value indicating whether to use character replacements or not.
The default value is false
.
public final void setUseCharacterReplacements(boolean value)
Sets a value indicating whether to use character replacements or not.
The default value is false
.
value
- A value indicating whether to use character replacements or not.public final boolean getAutoDetectEncoding()
Gets a value indicating whether to detect encoding automatically or not.
The default value is false
.
public final void setAutoDetectEncoding(boolean value)
Sets a value indicating whether to detect encoding automatically or not.
The default value is false
.
value
- A value indicating whether to detect encoding automatically or not.public final boolean getUseRawTextExtraction()
Gets a value indicating whether the raw mode is used for text extraction if possible.
The default value is true
.
The raw mode can significantly increase the indexing speed, but normal mode improves the formatting of the extracted text.
public final void setUseRawTextExtraction(boolean value)
Sets a value indicating whether the raw mode is used for text extraction if possible.
The default value is true
.
The raw mode can significantly increase the indexing speed, but normal mode improves the formatting of the extracted text.
value
- A value indicating whether the raw mode is used for text extraction if possible.public final DocumentFilter getDocumentFilter()
Gets a document filter.
The DocumentFilter
works on the inclusion logic.
Use the DocumentFilter
class for creation a document filter instance.
The default value is null
, which means that all added documents are indexed.
The example demonstrates how to set the document filter.
String indexFolder = "c:\\MyIndex\\";
String documentsFolder = "c:\\MyDocuments\\";
// Creating a filter that skips documents with extensions '.doc', '.docx', '.rtf'
IndexSettings settings = new IndexSettings();
DocumentFilter fileExtensionFilter = DocumentFilter.createFileExtension(".doc", ".docx", ".rtf"); // Creating file extension filter
DocumentFilter invertedFilter = DocumentFilter.createNot(fileExtensionFilter); // Inverting file extension filter
settings.setDocumentFilter(invertedFilter);
// Creating an index in the specified folder
Index index = new Index(indexFolder, settings);
// Indexing documents
index.add(documentsFolder);
// Searching
SearchResult result = index.search("Einstein");
public final void setDocumentFilter(DocumentFilter value)
Sets a document filter.
The DocumentFilter
works on the inclusion logic.
Use the GroupDocs.Search.Options.DocumentFilter
class for creation of a document filter instances.
The default value is null
, which means that all added documents are indexed.
value
- The document filter.
The example demonstrates how to set the document filter.
String indexFolder = "c:\\MyIndex\\";
String documentsFolder = "c:\\MyDocuments\\";
// Creating a filter that skips documents with extensions '.doc', '.docx', '.rtf'
IndexSettings settings = new IndexSettings();
DocumentFilter fileExtensionFilter = DocumentFilter.createFileExtension(".doc", ".docx", ".rtf"); // Creating file extension filter
DocumentFilter invertedFilter = DocumentFilter.createNot(fileExtensionFilter); // Inverting file extension filter
settings.setDocumentFilter(invertedFilter);
// Creating an index in the specified folder
Index index = new Index(indexFolder, settings);
// Indexing documents
index.add(documentsFolder);
// Searching
SearchResult result = index.search("Einstein");
public final TextStorageSettings getTextStorageSettings()
Gets the text storage settings.
The default value is null
, which means that document texts are not stored.
The example demonstrates how to set the text storage settings.
String indexFolder = "c:\\MyIndex\\";
String documentsFolder = "c:\\MyDocuments\\";
// Creating index settings instance
IndexSettings settings = new IndexSettings();
settings.setTextStorageSettings(new TextStorageSettings(Compression.High)); // Setting high compression level for the index text storage
// Creating an index in the specified folder
Index index = new Index(indexFolder, settings);
// Indexing documents
index.add(documentsFolder);
// Searching
SearchResult result = index.search("Einstein");
public final void setTextStorageSettings(TextStorageSettings value)
Sets the text storage settings.
The default value is null
, which means that document texts are not stored.
value
- The text storage settings.
The example demonstrates how to set the text storage settings.
String indexFolder = "c:\\MyIndex\\";
String documentsFolder = "c:\\MyDocuments\\";
// Creating index settings instance
IndexSettings settings = new IndexSettings();
settings.setTextStorageSettings(new TextStorageSettings(Compression.High)); // Setting high compression level for the index text storage
// Creating an index in the specified folder
Index index = new Index(indexFolder, settings);
// Indexing documents
index.add(documentsFolder);
// Searching
SearchResult result = index.search("Einstein");
public final IndexType getIndexType()
Gets the index type.
The default value is GroupDocs.Search.Options.IndexType.NormalIndex
.
public final void setIndexType(IndexType value)
Sets the index type.
The default value is GroupDocs.Search.Options.IndexType.NormalIndex
.
value
- The index type.public final NumberOfThreads getSearchThreads()
Gets the number of threads used for the search.
The default value is GroupDocs.Search.Options.NumberOfThreads.Default
,
which means that the search will be performed using the number of threads equal to the number of processor cores.
public final void setSearchThreads(NumberOfThreads value)
Sets the number of threads used for the search.
The default value is GroupDocs.Search.Options.NumberOfThreads.Default
,
which means that the search will be performed using the number of threads equal to the number of processor cores.
value
- The number of threads used for the search.public final CustomExtractorCollection getCustomExtractors()
Gets the custom extractor collection.
The full example of implementing a custom extractor is presented in documentation for GroupDocs.Search.Common.IFieldExtractor
interface.
public final ILogger getLogger()
Gets a logger that is used for logging events and errors in the index. Note that the logger is not saved and must be created and assigned each time the index is created or loaded.
public final void setLogger(ILogger value)
Sets a logger that is used for logging events and errors in the index. Note that the logger is not saved and must be created and assigned each time the index is created or loaded.
value
- A logger that is used for logging events and errors in the index.protected static boolean isReadOnly(IndexSettings settings)