Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
string indexFolder = @"D://Samples/Index";
string documentsFolder = @"D://Samples/Source/Index";
// Creating index in the specified folder
Index index = new Index(indexFolder);
// Indexing documents from the specified folder
// Searching in index
SearchResult result = index.Search("video");
for (int i = 0; i < result.DocumentCount; i++)
if (result.DocumentCount > 0)
FoundDocument document = result.GetFoundDocument(i); // Getting the first found document
OutputAdapter outputAdapter = new FileOutputAdapter(@"D:\Highlighted" + i + ".html"); // Creating the output adapter to a file
HtmlHighlighter highlighter = new HtmlHighlighter(outputAdapter); // Creating the highlighter object
index.Highlight(document, highlighter); // Generating output HTML formatted document with highlighted search results
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.