lucenenet icon indicating copy to clipboard operation
lucenenet copied to clipboard

FuzzyQuery produces a wrong result when prefix is equal to the term length

Open tohidemyname opened this issue 1 year ago • 2 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Describe the bug

When using FuzzyQuery the search string bba does not match doc value bbab with an edit distance of 1 and prefix length of 3.

In FuzzyQuery an automaton is created for the "suffix" part of the search string which in this case is an empty string.

Expected Behavior

In this scenario maybe the FuzzyQuery should rewrite to a WildcardQuery of the following form :

searchString + "?" 

where there's an appropriate number of ? characters according to the edit distance.

Steps To Reproduce

No response

Exceptions (if any)

No response

Lucene.NET Version

No response

.NET Version

No response

Operating System

No response

Anything else?

No response

tohidemyname avatar Jun 04 '24 04:06 tohidemyname

I just submitted my patch: https://github.com/apache/lucenenet/pull/942/commits

tohidemyname avatar Jun 04 '24 04:06 tohidemyname

I fixed two bugs. To submit separate pull requests, I reverted my changes after I fixed a bug. I am unsure whether I wrongly close my pull request or not. I have submitted another pull request:

https://github.com/apache/lucenenet/pull/945

tohidemyname avatar Jun 05 '24 00:06 tohidemyname