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

LUCENE-10115: Add an extension point for custom query parsers to determine the similarity distance for fuzzy queries #314

Merged
merged 2 commits into from Sep 21, 2021

Conversation

ChrisHegarty
Copy link
Contributor

Description

Add an extension point for custom query parsers to determine the similarity distance for fuzzy queries. This will be used by the elasticsearch query parser to customise how similarity distances are determined.

Solution

This PR adds the QueryParserBase::getFuzzyDistance protected method, which can be overridden by subclasses to provide customisation of how the similarity distance is determined. The default implementation behaves as the current, before-this-change, behaviour.

Tests

An additional test scenarios, testFuzzyDistanceExtendability, has been added that exercises the default functionality, as well as how a custom implementation could behave.

Checklist

Please review the following and check all that apply:

  • I have reviewed the guidelines for How to Contribute and my code conforms to the standards described there to the best of my ability.
  • I have created a Jira issue and added the issue ID to my pull request title.
  • I have given Lucene maintainers access to contribute to my PR branch. (optional but recommended)
  • I have developed this patch against the main branch.
  • I have run ./gradlew check.
  • I have added tests for my changes.

Copy link
Contributor

@jpountz jpountz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add an entry to lucene/CHANGES.txt for version 9.0?

@ChrisHegarty
Copy link
Contributor Author

Can you add an entry to lucene/CHANGES.txt for version 9.0?

@jpountz Yes, I will add an entry to the "API Changes" section and update this PR.

Copy link
Contributor

@romseygeek romseygeek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ChrisHegarty!

@romseygeek romseygeek merged commit a757870 into apache:main Sep 21, 2021
@ChrisHegarty ChrisHegarty deleted the fuzziness branch October 1, 2021 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants