fix(azure-ai-search): validate filter value types and escape quotes in OData (#5983)

This commit is contained in:
Hrushikesh Yadav
2026-06-29 20:31:26 +05:30
committed by GitHub
parent 2dcb3542f8
commit 3619fd77ae
2 changed files with 40 additions and 1 deletions
+8 -1
View File
@@ -199,8 +199,15 @@ class AzureAISearch(VectorStoreBase):
if isinstance(value, str):
safe_value = value.replace("'", "''")
condition = f"{safe_key} eq '{safe_value}'"
else:
elif isinstance(value, bool):
condition = f"{safe_key} eq {str(value).lower()}"
elif isinstance(value, (int, float)):
condition = f"{safe_key} eq {value}"
else:
raise ValueError(
f"Filter value for {key!r} must be str, int, float, or bool, "
f"got {type(value).__name__}"
)
filter_conditions.append(condition)
filter_expression = " and ".join(filter_conditions)
return filter_expression