We are trying to use the fuzzy field modifier "~" in our raw queries to catch results for misspelled words.
Our search logic looks like this:
Dim searcher = ExamineManager.Instance.SearchProviderCollection(searchProviderName) Dim searchCriteria = searcher.CreateSearchCriteria() Dim query = searchCriteria.RawQuery("badlyspelledword") Dim results As ISearchResults = searcher.Search(query) If Not IsNothing(results) Then If Not results.Count = 0 Then Return results End If End If ' Recheck with misspelled words query = searchCriteria.RawQuery("badlyspelledword~") Return searcher.Search(query)
I have also tried:
Adjusting the threshold for the fuzzy algorithm to super low: "badlyspelledword~0.2"
I've had no luck with any of these. For example I am trying to find results for a term which has many documents in our tree "ginkgo" by searching for "gink", or "ginko" and none of these methods are successful.
Our index set is built to include all of the attribute fields as default strings for the node types we want to search in our tree. It uses the default analyzer (which I assume is the Lucene StandardAnalyzer).
Can anyone offer me any hints for where I might be going wrong with either the RawQuery use of the modifier ~ or with the Fluent API that would make this not work?
Examine fuzzy searches not working
Hi there,
We are trying to use the fuzzy field modifier "~" in our raw queries to catch results for misspelled words.
Our search logic looks like this:
I have also tried:
I've had no luck with any of these. For example I am trying to find results for a term which has many documents in our tree "ginkgo" by searching for "gink", or "ginko" and none of these methods are successful.
Our index set is built to include all of the attribute fields as default strings for the node types we want to search in our tree. It uses the default analyzer (which I assume is the Lucene StandardAnalyzer).
Can anyone offer me any hints for where I might be going wrong with either the RawQuery use of the modifier ~ or with the Fluent API that would make this not work?
Thanks,
Robert Hawkey
It turns out that it's bad to re-use the ISearchCriteria object, so this code works:
is working on a reply...