Skip to content

Conversation

@mkhludnev
Copy link
Member

fix #14425

Description

Comment on lines +177 to +178
return TermInSetQuery.newIndexOrDocValuesQuery(
MultiTermQuery.CONSTANT_SCORE_BLENDED_REWRITE, field, values);
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably we can use TermInSetQuery.newIndexOrDocValuesQuery(field, values) here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Right. Just want to make it explicit.

Copy link
Contributor

Choose a reason for hiding this comment

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

Then we don't need that method, right?

Copy link
Contributor

Choose a reason for hiding this comment

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

I would agree with this. KeywordField#newSetQuery is the convenience method, so it's nice to not have to pass a rewrite, TermInSetQuery#newIndexOrDocValuesQuery is the expert method, and experts can figure out how they want their multi-term queries to be rewritten.

Copy link
Contributor

Choose a reason for hiding this comment

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

We should remove the unused method TermInSetQuery#newIndexOrDocValuesQuery(String field, Collection<BytesRef> terms) in that case, as anyone invoking TermInSetQuery#newIndexOrDocValuesQuery should use the expert method TermInSetQuery#newIndexOrDocValuesQuery(RewriteMethod indexRewriteMethod, String field, Collection<BytesRef> terms)?

Copy link
Member Author

Choose a reason for hiding this comment

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

ok. Got it. Since we add something, let's add as least as possible.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for making the change. I know its minor, but important for keeping it clean!

@mkhludnev mkhludnev changed the title KeywordField.newSetQuery() to uses prefixed terms for IndexOrDocValuesQuery KeywordField.newSetQuery() to reuse prefixed terms in IndexOrDocValuesQuery Apr 4, 2025
Comment on lines +177 to +178
return TermInSetQuery.newIndexOrDocValuesQuery(
MultiTermQuery.CONSTANT_SCORE_BLENDED_REWRITE, field, values);
Copy link
Contributor

Choose a reason for hiding this comment

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

I would agree with this. KeywordField#newSetQuery is the convenience method, so it's nice to not have to pass a rewrite, TermInSetQuery#newIndexOrDocValuesQuery is the expert method, and experts can figure out how they want their multi-term queries to be rewritten.

@mkhludnev mkhludnev merged commit 219cd5e into apache:main Apr 5, 2025
7 checks passed
@mkhludnev mkhludnev deleted the idx-or-dv-term-inset-q branch April 5, 2025 19:09
mkhludnev added a commit to mkhludnev/lucene that referenced this pull request Apr 5, 2025
…sQuery (apache#14435)

* KeywordField.newSetQuery() reuses prefixed terms.

fix apache#14425
mkhludnev added a commit that referenced this pull request Apr 5, 2025
…sQuery (#14435) (#14442)

* KeywordField.newSetQuery() reuses prefixed terms.

fix #14425
mkhludnev added a commit that referenced this pull request Apr 12, 2025
…sQuery (#14435) (#14478)

* KeywordField.newSetQuery() reuses prefixed terms.

fix #14425
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.

Reuse packedTerms between two TermInSetQuery which are combined by IndexOrDocValuesQuery

3 participants