Skip to content

Pattern replace keywords - #16489

Open
xabbu42 wants to merge 8 commits into
apache:mainfrom
xabbu42:pattern-replace-keywords
Open

Pattern replace keywords#16489
xabbu42 wants to merge 8 commits into
apache:mainfrom
xabbu42:pattern-replace-keywords

Conversation

@xabbu42

@xabbu42 xabbu42 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Description

Add an ignoreKeywords flag to PatternReplaceFilter similar to WordDelimiterGraphFilter. We use PatternReplaceFilter for some custom spelling normalization and minimal stemming and would like to use the existing mechanism to protect keywords.

Disclaimers

This pull request was created using aider and Claude Sonnet 4.

We don't use Lucene directly (I plan to do a follow up pull request for elasticsearch) so I could not yet check this changes besides the generated new tests. Please tell me if anything is missing.

xabbu42 and others added 6 commits August 5, 2026 10:03
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat>
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat>
…ds parameter

Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat>
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat>
…tion

Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat>
@xabbu42
xabbu42 marked this pull request as draft August 5, 2026 12:50
@xabbu42
xabbu42 marked this pull request as ready for review August 9, 2026 12:09
@msokolov

Copy link
Copy Markdown
Contributor

This seems reasonable, but:

  1. should we have a backwards-compatible constructor that does not require the new flag?
  2. I think PatternReplaceFilterFactory would also need to be updated

@xabbu42

xabbu42 commented Aug 20, 2026

Copy link
Copy Markdown
Contributor Author
  1. I actually removed the backwards-compatible constructor assuming that this is something internal. I can put it back. Should I copy-paste the documentation of the common arguments to both constructors?
  2. I did add handling of an ignoreKeywords flag to PatternReplaceFilterFactory, is anything else needed?

@msokolov

Copy link
Copy Markdown
Contributor

I'm not sure how I missed the factory change, sorry! As for the old constructor, this is a public method in a public class, and it's not marked @lucene.experimental, so we cannot remove it without a major release. Having said that, we could decide to make that change on main (targeting v. 11), and only add back the constructor if/when we backport the change to the 10.x branch from which we would cut any minor version release (10.6, etc). I don't have a strong opinion about that; it just seems easier to keep the old constructor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants