Created
October 10, 2019 12:26
-
-
Save GroupDocsGists/1e84ff71f71f21dc4274015c4f916a0c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string indexFolder = @"c:\MyIndex\"; | |
string documentsFolder = @"c:\MyDocuments\"; | |
// Creating an index in the specified folder | |
Index index = new Index(indexFolder); | |
// Indexing documents from the specified folder | |
index.AddToIndex(documentsFolder); | |
// Creating a search parameters object | |
SearchParameters parameters = new SearchParameters(); | |
parameters.FuzzySearch.Enabled = true; // Enabling the fuzzy search | |
parameters.FuzzySearch.FuzzyAlgorithm = new TableDiscreteFunction(2); // Setting the number of possible differences for each word | |
// Searching in the index | |
SearchResults results = index.Search("Happiness", parameters); | |
if (results.Count > 0) | |
{ | |
// Generating HTML-formatted text of a document with highlighted search results | |
index.HighlightInText(@"c:\Highlighted.html", results[0]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment