You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Python: Chroma and Weaviate filters double apostrophes in string values, so values like O'Brien never match #14559
A filter that compares a field to a string containing an apostrophe never matches in the Python Chroma and Weaviate connectors. The apostrophe is doubled (O'Brien becomes O''Brien) before the value is handed to the store, so it no longer equals the stored value.
Where
python/semantic_kernel/connectors/chroma.pyChromaCollection._lambda_parser, and python/semantic_kernel/connectors/weaviate.pyWeaviateCollection._lambda_parser, on current main (64005c7). Both have this in the ast.Constant case:
That is SQL-style escaping. These two connectors do not build a SQL or query string. Chroma gets a where dict ({"name": value}, {"$and": [...]}) and Weaviate gets Filter.by_property(...).equal(value) objects, so the value is sent as data and nothing needs escaping. The other dict-based connectors (MongoDB, Pinecone, Qdrant) return node.value unchanged. Only the string-building connectors (Azure AI Search, Postgres, SQL Server, Oracle) need the doubling.
The record with name="O'Brien" exists but is never returned. For Weaviate, _build_filter("lambda x: x.name == \"O'Brien\"") returns _FilterValue(value="O''Brien", operator=Equal, target='name').
Expected
{'name': "O'Brien"}, and the search returns record 1.
I searched open and closed issues and PRs for this and found nothing. I am opening a PR right after filing this.
Activity