IndexSearch Method (SearchQuery, SearchOptions)
Searches in index.

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

Parameters

query
Type: GroupDocs.SearchSearchQuery
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 search using query in object form.
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

// Creating subquery of date range search
SearchQuery subquery1 = SearchQuery.CreateDateRangeQuery(new DateTime(2011, 6, 17), new DateTime(2013, 1, 1));

// Creating subquery of wildcard with number of missed words from 0 to 2
SearchQuery subquery2 = SearchQuery.CreateWildcardQuery(0, 2);

// Creating subquery of simple word
SearchQuery subquery3 = SearchQuery.CreateWordQuery("birth");
subquery3.SearchOptions = new SearchOptions(); // Setting search options only for subquery 3
subquery3.SearchOptions.FuzzySearch.Enabled = true;
subquery3.SearchOptions.FuzzySearch.FuzzyAlgorithm = new TableDiscreteFunction(1);

// Combining subqueries into one query
SearchQuery query = SearchQuery.CreatePhraseSearchQuery(subquery1, subquery2, subquery3);

// Creating search options object with increased capacity of found occurrences
SearchOptions options = new SearchOptions(); // Overall search options
options.MaxOccurrenceCountPerTerm = 1000000;
options.MaxTotalOccurrenceCount = 10000000;

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