usmanazizgroupdocs
10/13/2016 - 5:20 PM

GetMatchingWordsInFuzzySearchResult.vb

' For complete examples and data files, please go to https://github.com/groupdocs-search/GroupDocs.Search-for-.NET
Dim index As New Index(Utilities.indexPath)
index.AddToIndex(Utilities.documentsPath)

Dim parameters As New SearchParameters()
' turning on Fuzzy search feature
parameters.FuzzySearch.Enabled = True

' set low similarity level to search for less similar words and get more results
parameters.FuzzySearch.SimilarityLevel = 0.2

Dim fuzzySearchResults As SearchResults = index.Search(searchString, parameters)
For Each documentResultInfo As DocumentResultInfo In fuzzySearchResults
    Console.WriteLine("Document {0} was found with query ""{1}""" & vbLf & "Words list that was found in document:", documentResultInfo.FileName, searchString)
    For Each term As String In documentResultInfo.Terms
        Console.Write("{0}; ", term)
    Next
    Console.WriteLine()
Next

Dim regexSearchResults As SearchResults = index.Search(searchString)

For Each documentResultInfo As DocumentResultInfo In regexSearchResults
    Console.WriteLine("Document {0} was found with query ""{1}""" & vbLf & "Words list that was found in document:", documentResultInfo.FileName, regexSearchResults)
    For Each term As String In documentResultInfo.Terms
        Console.Write("{0}; ", term)
    Next
    Console.WriteLine()
Next