public class SearchOptions extends Object
Learn more
| Modifier | Constructor and Description |
|---|---|
|
SearchOptions()
Initializes a new instance of the
SearchOptions class. |
|
SearchOptions(Object data)
Initializes a new instance of the
SearchOptions class. |
protected |
SearchOptions(Object state1,
Object state2)
Initializes a new instance of the
SearchOptions class. |
| Modifier and Type | Method and Description |
|---|---|
Cancellation |
getCancellation()
Gets the operation cancellation object.
|
Object |
getCore() |
DateFormatCollection |
getDateFormats()
Gets the collection of date formats for date range search.
|
FuzzySearchOptions |
getFuzzySearch()
Gets the fuzzy search options.
|
KeyboardLayoutCorrectorOptions |
getKeyboardLayoutCorrector()
Gets the keyboard layout corrector options.
|
int |
getMaxOccurrenceCountPerTerm()
Gets the maximum number of occurrences of each term in a search query.
|
int |
getMaxTotalOccurrenceCount()
Gets the maximum total number of occurrences of all terms in a search query.
|
boolean |
getRetrieveAttributes()
Gets the flag of retrieving attributes associated with found documents.
|
ISearchDocumentFilter |
getSearchDocumentFilter()
Gets the search document filter.
|
SpellingCorrectorOptions |
getSpellingCorrector()
Gets the spelling corrector options.
|
boolean |
getUseCaseSensitiveSearch()
Gets the flag of case sensitive search.
|
boolean |
getUseHomophoneSearch()
Gets the flag of use homophones in search.
|
boolean |
getUseSynonymSearch()
Gets the flag of use synonyms in search.
|
boolean |
getUseWordFormsSearch()
Gets the flag of use different word forms in search.
|
boolean |
isChunkSearch()
Gets the flag of search by chunks.
|
void |
setCancellation(Cancellation value)
Sets the operation cancellation object.
|
void |
setChunkSearch(boolean value)
Sets the flag of search by chunks.
|
void |
setMaxOccurrenceCountPerTerm(int value)
Sets the maximum number of occurrences of each term in a search query.
|
void |
setMaxTotalOccurrenceCount(int value)
Sets the maximum total number of occurrences of all terms in a search query.
|
void |
setRetrieveAttributes(boolean value)
Sets the flag of retrieving attributes associated with found documents.
|
void |
setSearchDocumentFilter(ISearchDocumentFilter value)
Sets the search document filter.
|
void |
setUseCaseSensitiveSearch(boolean value)
Sets the flag of case sensitive search.
|
void |
setUseHomophoneSearch(boolean value)
Sets the flag of use homophones in search.
|
void |
setUseSynonymSearch(boolean value)
Sets the flag of use synonyms in search.
|
void |
setUseWordFormsSearch(boolean value)
Sets the flag of use different word forms in search.
|
public SearchOptions()
SearchOptions class.public SearchOptions(Object data)
SearchOptions class.data - The serialized data.public Cancellation getCancellation()
null.public Object getCore()
public DateFormatCollection getDateFormats()
The example demonstrates how to set the date formats for the search.
String indexFolder = "c:\\MyIndex\\";
String documentsFolder = "c:\\MyDocuments\\";
String query = "Einstein";
Index index = new Index(indexFolder); // Creating an index in the specified folder
index.add(documentsFolder); // Indexing documents from the specified folder
SearchOptions options = new SearchOptions();
options.getDateFormats().clear(); // Removing default date formats
DateFormatElement[] elements = new DateFormatElement[] {
DateFormatElement.getMonthTwoDigits(),
DateFormatElement.getDayOfMonthTwoDigits(),
DateFormatElement.getYearFourDigits(),
};
// Creating a date format pattern 'MM/dd/yyyy'
com.groupdocs.search.DateFormat dateFormat = new com.groupdocs.search.DateFormat(elements, "/");
options.getDateFormats().addItem(dateFormat);
SearchResult result = index.search(query, options); // Search in index
public FuzzySearchOptions getFuzzySearch()
public KeyboardLayoutCorrectorOptions getKeyboardLayoutCorrector()
public int getMaxOccurrenceCountPerTerm()
100000.public int getMaxTotalOccurrenceCount()
500000.public boolean getRetrieveAttributes()
false.public ISearchDocumentFilter getSearchDocumentFilter()
SearchDocumentFilter works on the inclusion logic.
Use SearchDocumentFilter class for creation of a search document filter instances.
The default value is null, which means that all found documents will be returned.The example demonstrates how to set the document filter.
String indexFolder = "c:\\MyIndex\\";
String documentsFolder = "c:\\MyDocuments1\\";
// Creating an index in the specified folder
Index index = new Index(indexFolder);
// Indexing documents
index.add(documentsFolder);
// Creating a search document filter that skips documents with extensions '.doc', '.docx', '.rtf'
SearchOptions options = new SearchOptions();
ISearchDocumentFilter fileExtensionFilter = SearchDocumentFilter.createFileExtension(".doc", ".docx", ".rtf"); // Creating file extension filter
ISearchDocumentFilter invertedFilter = SearchDocumentFilter.createNot(fileExtensionFilter); // Inverting file extension filter
options.setSearchDocumentFilter(invertedFilter);
// Search in index
SearchResult result = index.search("Einstein", options);
public SpellingCorrectorOptions getSpellingCorrector()
public boolean getUseCaseSensitiveSearch()
false.public boolean getUseHomophoneSearch()
false.public boolean getUseSynonymSearch()
false.public boolean getUseWordFormsSearch()
false.public boolean isChunkSearch()
false.public void setCancellation(Cancellation value)
null.value - The operation cancellation object.public void setChunkSearch(boolean value)
false.value - The flag of search by chunks.public void setMaxOccurrenceCountPerTerm(int value)
100000.value - The maximum number of occurrences of each term in a search query.public void setMaxTotalOccurrenceCount(int value)
500000.value - The maximum total number of occurrences.public void setRetrieveAttributes(boolean value)
false.value - The flag of retrieving attributes associated with found documents.public void setSearchDocumentFilter(ISearchDocumentFilter value)
SearchDocumentFilter works on the inclusion logic.
Use SearchDocumentFilter class for creation of a search document filter instances.
The default value is null, which means that all found documents will be returned.value - The search document filter.
The example demonstrates how to set the document filter.
String indexFolder = "c:\\MyIndex\\";
String documentsFolder = "c:\\MyDocuments1\\";
// Creating an index in the specified folder
Index index = new Index(indexFolder);
// Indexing documents
index.add(documentsFolder);
// Creating a search document filter that skips documents with extensions '.doc', '.docx', '.rtf'
SearchOptions options = new SearchOptions();
ISearchDocumentFilter fileExtensionFilter = SearchDocumentFilter.createFileExtension(".doc", ".docx", ".rtf"); // Creating file extension filter
ISearchDocumentFilter invertedFilter = SearchDocumentFilter.createNot(fileExtensionFilter); // Inverting file extension filter
options.setSearchDocumentFilter(invertedFilter);
// Search in index
SearchResult result = index.search("Einstein", options);
public void setUseCaseSensitiveSearch(boolean value)
false.value - The flag of case sensitive search.public void setUseHomophoneSearch(boolean value)
false.value - The flag of use homophones in search.public void setUseSynonymSearch(boolean value)
false.value - The flag of use synonyms in search.public void setUseWordFormsSearch(boolean value)
false.value - The flag of use different word forms in search.Copyright © 2026. All rights reserved.