-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
apply_filter_policy
and FilterPolicy.MERGE
don't work properly for the new filter syntax
#7995
Comments
vblagoje
changed the title
Jul 8, 2024
apply_filter_policy
doesn't work properly for new filter syntaxapply_filter_policy
and FilterPolicy.MERGE
don't work properly for the new filter syntax
@julian-risch @mrm1001 this one is needed for the final 2.3.0 release cc @sjrl |
I have the most context to fix this one and @sjrl will review |
So I think there are three basic scenarios that we might like to cover:
comparison_filter_1 = {"field": "meta.name", "operator": "==", "value": "John"}
comparison_filter_2 = {"field": "meta.year", "operator": "==", "value": "2022"}
user_provided_logical_filter = "AND"
combined_filter = {
"operator": "AND",
"conditions": [
{"field": "meta.name", "operator": "==", "value": "John"},
{"field": "meta.year", "operator": "==", "value": "2022"}
]
}
comparison_filter = {"field": "meta.type", "operator": "==", "value": "pdf"}
logical_filter = {
"operator": "AND",
"conditions": [
{"field": "meta.name", "operator": "==", "value": "John"},
{"field": "meta.year", "operator": "==", "value": "2022"}
]
}
user_provided_logical_filter = "AND"
combined_filter = {
"operator": "AND",
"conditions": [
{"field": "meta.name", "operator": "==", "value": "John"},
{"field": "meta.year", "operator": "==", "value": "2022"},
{"field": "meta.type", "operator": "==", "value": "pdf"}
]
}
logical_filter_1 = {
"operator": "AND",
"conditions": [
{"field": "meta.type", "operator": "==", "value": "pdf"},
{"field": "meta.month", "operator": "==", "value": "April"}
]
}
logical_filter_2 = {
"operator": "AND",
"conditions": [
{"field": "meta.name", "operator": "==", "value": "John"},
{"field": "meta.year", "operator": "==", "value": "2022"}
]
}
combined_filter = {
"operator": "AND",
"conditions": [
{"field": "meta.name", "operator": "==", "value": "John"},
{"field": "meta.year", "operator": "==", "value": "2022"},
{"field": "meta.type", "operator": "==", "value": "pdf"},
{"field": "meta.month", "operator": "==", "value": "April"}
]
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is your feature request related to a problem? Please describe.
The current
apply_filter_policy
function in our retrieval system only supports legacy dictionary-based filters. This limitation becomes problematic for new filters syntax. For example, we can't merge filters like:{"field": "meta.name", "operator": "==", "value": "John"}
and{"field": "meta.year", "operator": "==", "value": "2022"}
using the current implementation.Describe the solution you'd like
Update the
apply_filter_policy
function to support both the legacy filters and a new filter format merge functionality. The function should:Accept both old and new filters as input for
init_filters
andruntime_filters
.Properly merge (or replace) filters based on the
FilterPolicy
for both formats.Describe alternatives you've considered
Not considered
Additional context
This change is crucial for improving handling both legacy and new filters and applying
FilterPolicy
correctly.The text was updated successfully, but these errors were encountered: