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

Fix for propagating filters from compound to inner retrievers #117914

Merged

Conversation

pmpailis
Copy link
Contributor

@pmpailis pmpailis commented Dec 3, 2024

This PR aims to fix an issue where the inner filters are not properly added to the children of compound retrievers if they require different number of rewrite rounds.

@pmpailis pmpailis added >bug :Search Relevance/Ranking Scoring, rescoring, rank evaluation. auto-backport Automatically create backport pull requests when merged v8.16.2 v8.17.1 v8.18.0 labels Dec 4, 2024
@elasticsearchmachine
Copy link
Collaborator

Hi @pmpailis, I've created a changelog YAML for you.

this.rankWindowSize = rankWindowSize;
this.rankDocs = rankDocs;
if (sources == null || sources.isEmpty()) {
throw new IllegalArgumentException("sources must not be null or empty");
}
this.sources = sources;
this.preFilterQueryBuilders = preFilterQueryBuilders;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The prefilters were not actually used anywhere for the RankDocsRetrieverBuilder as they had already been accounted for when computing the parent results.

@pmpailis pmpailis marked this pull request as ready for review December 4, 2024 08:46
@elasticsearchmachine elasticsearchmachine added the Team:Search Relevance Meta label for the Search Relevance team in Elasticsearch label Dec 4, 2024
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-search-relevance (Team:Search Relevance)

@pmpailis
Copy link
Contributor Author

pmpailis commented Dec 4, 2024

run elasticsearch-ci/part-3

Copy link
Member

@benwtrent benwtrent left a comment

Choose a reason for hiding this comment

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

Could you add a test that exposes the bug? My understanding was that it appeared when using a top level filter with a query_vector_builder in kNN. Lets add a test for that somewhere. It can be a simple single node test (not yaml).

To make the query vector builder stuff easier to test, you can maybe add a "test query vector builder" that simply returns a constant vector.

@pmpailis
Copy link
Contributor Author

pmpailis commented Dec 4, 2024

Could you add a test that exposes the bug? My understanding was that it appeared when using a top level filter with a query_vector_builder in kNN. Lets add a test for that somewhere. It can be a simple single node test (not yaml).

To make the query vector builder stuff easier to test, you can maybe add a "test query vector builder" that simply returns a constant vector.

That's a good idea. The query_vector_builder is a sub-case of the actual bug, but it wasn't so straightforward to add it as a yaml test. Will add a standard single node test instead as suggested, thanks! :)

@pmpailis pmpailis merged commit 0d4c0f2 into elastic:main Dec 5, 2024
16 checks passed
pmpailis added a commit to pmpailis/elasticsearch that referenced this pull request Dec 5, 2024
@elasticsearchmachine
Copy link
Collaborator

elasticsearchmachine commented Dec 5, 2024

💔 Backport failed

Status Branch Result
8.16
8.17
8.x

You can use sqren/backport to manually backport by running backport --upstream elastic/elasticsearch --pr 117914

pmpailis added a commit to pmpailis/elasticsearch that referenced this pull request Dec 5, 2024
elasticsearchmachine pushed a commit that referenced this pull request Dec 5, 2024
…117914) (#118045)

* Fix for propagating filters from compound to inner retrievers (#117914)

* Update RRFRetrieverBuilderIT.java
elasticsearchmachine pushed a commit that referenced this pull request Dec 5, 2024
…117914) (#118046)

* Fix for propagating filters from compound to inner retrievers (#117914)

* Update RRFRetrieverBuilderIT.java
elasticsearchmachine pushed a commit that referenced this pull request Dec 6, 2024
…117914) (#118047)

* Fix for propagating filters from compound to inner retrievers

* fix for lucene 9

* Update CompoundRetrieverBuilder.java

* Update CompoundRetrieverBuilder.java

* Update CompoundRetrieverBuilder.java

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
@leemthompo
Copy link
Contributor

@benwtrent what's the procedure for flagging bugs in affected versions? Or do we just rely on the bug fix notice in the fixed version to communicate this?

@benwtrent
Copy link
Member

@leemthompo if it deserves a "known issue" call out in the release versions, then that needs to be added manually. Otherwise, the release notes already automatically contains the bug fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Automatically create backport pull requests when merged >bug :Search Relevance/Ranking Scoring, rescoring, rank evaluation. Team:Search Relevance Meta label for the Search Relevance team in Elasticsearch v8.16.2 v8.17.1 v8.18.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants