Skip to content

Handle case where query is a compound query#1319

Merged
austin-aryn-ai merged 2 commits into
mainfrom
compound-query-filter
May 29, 2025
Merged

Handle case where query is a compound query#1319
austin-aryn-ai merged 2 commits into
mainfrom
compound-query-filter

Conversation

@austin-aryn-ai
Copy link
Copy Markdown
Contributor

No description provided.

expected = {"p3"}
assert expected == {d.doc_id for d in retrieved_docs}

query_with_filter = {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

keep the old test, it still seems valid. Make a new test test_compound_query.

"must": [actual_query],
"filter": [{"terms": filter}],

if is_compound_query(query):
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Per IM discussion, don't do this, instead always wrap -- add a test for the wrapping of a compound query.

https://docs.opensearch.org/docs/latest/query-dsl/compound/index/
says you can have multiple levels "Compound queries serve as wrappers for multiple leaf or compound clauses either to combine their results or to modify their behavior."

@austin-aryn-ai austin-aryn-ai enabled auto-merge (squash) May 29, 2025 21:27
@austin-aryn-ai austin-aryn-ai merged commit 1e3ca99 into main May 29, 2025
12 of 15 checks passed
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.

2 participants