IndexSearch Method (String, SearchOptions)
Searches in index.

Namespace: GroupDocs.Search
Assembly: GroupDocs.Search (in GroupDocs.Search.dll) Version: 20.11
Syntax
public SearchResult Search(
	string query,
	SearchOptions options
)

Parameters

query
Type: SystemString
The search query.
options
Type: GroupDocs.Search.OptionsSearchOptions
The search options.

Return Value

Type: SearchResult
The search result.
Examples
The following example demonstrates how to perform fuzzy search.
C#
string indexFolder = @"c:\MyIndex\";
string documentsFolder = @"c:\MyDocuments\";

Index index = new Index(indexFolder); // Creating index in the specified folder
index.Add(documentsFolder); // Indexing documents from the specified folder

SearchOptions options = new SearchOptions();
options.FuzzySearch.Enabled = true; // Enabling the fuzzy search
options.FuzzySearch.FuzzyAlgorithm = new TableDiscreteFunction(1); // Setting the number of possible differences for each word

// Double quotes at the beginning and end tells the index that it is phrase search query
string query = "\"The Pursuit of Happiness\"";
SearchResult result = index.Search(query, options); // Searching
Examples
The following example demonstrates how to perform synonym search.
C#
string indexFolder = @"c:\MyIndex\";
string documentsFolder = @"c:\MyDocuments\";

Index index = new Index(indexFolder); // Creating index in the specified folder
index.Add(documentsFolder); // Indexing documents from the specified folder

SearchOptions options = new SearchOptions();
options.UseSynonymSearch = true; // Enabling the synonym search

string query = "cry";
SearchResult result = index.Search(query, options); // Searching
See Also