GroupDocsGists
10/24/2017 - 1:26 PM

Examples-CSharp-GroupDocs.Search.Examples.CSharp-Searching-SynonymSearch.cs

// For complete examples and data files, please go to https://github.com/atirtahirgroupdocs/GroupDocs.Search-for-.NET
// Create or load index
Index index = new Index(Utilities.indexPath);

// load synonyms
index.LoadSynonyms(Utilities.synonymFilePath);

index.AddToIndex(Utilities.documentsPath);

// Turning on synonym search feature
SearchParameters parameters = new SearchParameters();
parameters.UseSynonymSearch = true;

// searching for documents with words one of words "remote", "virtual" or "online"
SearchResults searchResults = index.Search(searchString, parameters);

// List of found files
foreach (DocumentResultInfo documentResultInfo in searchResults)
{
    Console.Write(documentResultInfo.FileName + "\n");
}