The example demonstrates a typical usage of the class.
stringindexFolder=@"c:\MyIndex\";stringdocumentsFolder=@"c:\MyDocuments\";// Creating an indexIndexindex=newIndex(indexFolder);// Indexing documents from the specified folderindex.Add(documentsFolder);// Search for the word 'Einstein'SearchResultresult=index.Search("Einstein");// Assigning highlight optionsHighlightOptionsoptions=newHighlightOptions();options.TermsBefore=5;options.TermsAfter=5;options.TermsTotal=15;// Highlighting found words in the text of a documentFoundDocumentdocument=result.GetFoundDocument(0);FragmentHighlighterhighlighter=newFragmentHighlighter(OutputFormat.Html);index.Highlight(document,highlighter,options);// Getting the resultFragmentContainer[]fragmentContainers=highlighter.GetResult();for(inti=0;i<fragmentContainers.Length;i++){FragmentContainercontainer=fragmentContainers[i];string[]fragments=container.GetFragments();if(fragments.Length>0){Console.WriteLine(container.FieldName);Console.WriteLine();for(intj=0;j<fragments.Length;j++){// Printing HTML markup to consoleConsole.WriteLine(fragments[j]);Console.WriteLine();}}}