[MDS-6562] Fix filtering of permit conditions#3595
Merged
simensma-fresh merged 3 commits intodevelopfrom Jul 14, 2025
Merged
Conversation
simensma-fresh
commented
Jul 7, 2025
| query_embedding: List[float], | ||
| top_k: int = 25, | ||
| filters: Optional[Dict[str, Any]] = None, | ||
| filters: Optional[str] = None, |
Collaborator
Author
There was a problem hiding this comment.
The filters param here is now just the Odata expression, so str is correct
|
simensma-fresh
commented
Jul 7, 2025
| fields_dict = {field.name: field for field in fields} | ||
| og_fltr = fltrs.COMPARISON_OPERATORS | ||
|
|
||
| def override_comparison_operators(op, func): |
Collaborator
Author
There was a problem hiding this comment.
Don't like this one bit, but here we are 😅
sggerard
approved these changes
Jul 7, 2025
taraepp
approved these changes
Jul 9, 2025
matbusby-fw
approved these changes
Jul 10, 2025
Collaborator
matbusby-fw
left a comment
There was a problem hiding this comment.
😬. Nice workaround. Too bad we need it though.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Objective
MDS-6562
There's a bug in the Haystack Azure AI Search integration where it doesn't handle collection index field types correctly.
Issue: Filters on a field of the type Collection(...) fails with an error (it works for single fields).
Expected Odata filter syntax for a collection field is:
field/any(field: <filter>)wherefieldis the name of the field andvalueis the value to filter on. The haystack integration spits out just the part.Example:
search.in(field, 'value1,value2', ',')should befield/any(field: search.in(field, 'value1,value2', ',')), but is not.The following code overrides the comparison operators to handle a collection index field type.
Why override and not fix the bug in Haystack? This aims to fix it specifically for our use case,
a more general fix would require more considerations (e.g. handle 'any' vs 'all', complex types etc.).
Reference: https://learn.microsoft.com/en-us/azure/search/search-query-odata-filter