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
Refactor PgVercorStore filter template to use JSONB field access
Changed the filter template in PgVercorStore to replace JSONPath expressions with JSONB field access, using standard SQL operators such as '=' instead of '==', 'AND' instead of '&&', and 'OR' instead of '||'. This adjustment addresses compatibility issues with the 'IN' operator, which previously returned parse errors. Also updated PgVectorFilterExpressionConverter and corresponding tests to align with these changes.
- Replaced `metadata::jsonb @@ '$.key == "value"'::jsonpath` with `metadata::jsonb->>'$.key' = 'value'`
- Fixed parsing issues with `metadata::jsonb @@ '$.key in ["value"]'::jsonpath` by using JSONB field access.
- Updated logical operators IN filter expressions to standard SQL syntax.
These changes improve the clarity, execution reliability, and compatibility of filter expressions in the database.
Copy file name to clipboardExpand all lines: spring-ai-core/src/main/java/org/springframework/ai/vectorstore/filter/converter/PgVectorFilterExpressionConverter.java
Copy file name to clipboardExpand all lines: spring-ai-core/src/test/java/org/springframework/ai/vectorstore/filter/converter/PgVectorFilterExpressionConverterTests.java
+12-9Lines changed: 12 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -46,7 +46,7 @@ public class PgVectorFilterExpressionConverterTests {
Copy file name to clipboardExpand all lines: vector-stores/spring-ai-pgvector-store/src/main/java/org/springframework/ai/vectorstore/PgVectorStore.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -292,7 +292,7 @@ public List<Document> similaritySearch(SearchRequest request) {
292
292
StringjsonPathFilter = "";
293
293
294
294
if (StringUtils.hasText(nativeFilterExpression)) {
Copy file name to clipboardExpand all lines: vector-stores/spring-ai-pgvector-store/src/test/java/org/springframework/ai/vectorstore/PgVectorStoreIT.java
+5Lines changed: 5 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -157,6 +157,11 @@ public void searchWithFilters(String distanceType) {
0 commit comments