Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
1 task done
tohidemyname opened this issue Jun 4, 2024 · 2 comments · Fixed by #1002
Closed
1 task done

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

tohidemyname opened this issue Jun 4, 2024 · 2 comments · Fixed by #1002

Comments

@tohidemyname
Copy link
Contributor

Is there an existing issue for this?

  • 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
Copy link
Contributor Author

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

@tohidemyname
Copy link
Contributor Author

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:

#945

@paulirwin paulirwin added this to the 4.8.0-beta00018 milestone Oct 28, 2024
paulirwin pushed a commit to paulirwin/lucene.net that referenced this issue Oct 29, 2024
paulirwin added a commit that referenced this issue Nov 4, 2024
…ength (#1002)

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

* Add LUCENENET-specific backport comment, fix test code style

---------

Co-authored-by: tohidemyname <tohidemyname>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants