From 5888fae82ce5ff36cb0e74f811978c8384b856a1 Mon Sep 17 00:00:00 2001 From: dperezcabrera Date: Thu, 11 Apr 2024 09:37:20 +0200 Subject: [PATCH] Refactor filter expression for clarity and accuracy The filter expression within the document handling logic has been updated to enhance clarity and ensure accurate author filtering. Previously, the `in` function mistakenly included names as direct arguments, potentially leading to ambiguity in filter application. This has been corrected by explicitly specifying the `author` field, ensuring the filter accurately applies to author names only. This change improves the maintainability and readability of the code, particularly in sections dealing with article filtering based on authorship and type. - Correct the filter expression by explicitly specifying the `author` field. - Ensure accurate and unambiguous author filtering in article management. --- .../main/antora/modules/ROOT/pages/api/vectordbs/milvus.adoc | 2 +- .../main/antora/modules/ROOT/pages/api/vectordbs/mongodb.adoc | 2 +- .../src/main/antora/modules/ROOT/pages/api/vectordbs/neo4j.adoc | 2 +- .../main/antora/modules/ROOT/pages/api/vectordbs/qdrant.adoc | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/vectordbs/milvus.adoc b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/vectordbs/milvus.adoc index e7ff7ac3e2e..948c0a2a826 100644 --- a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/vectordbs/milvus.adoc +++ b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/vectordbs/milvus.adoc @@ -145,7 +145,7 @@ vectorStore.similaritySearch(SearchRequest.defaults() .withTopK(TOP_K) .withSimilarityThreshold(SIMILARITY_THRESHOLD) .withFilterExpression(b.and( - b.in("john", "jill"), + b.in("author","john", "jill"), b.eq("article_type", "blog")).build())); ---- diff --git a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/vectordbs/mongodb.adoc b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/vectordbs/mongodb.adoc index 58274443db0..6ff1e8fa9d1 100644 --- a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/vectordbs/mongodb.adoc +++ b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/vectordbs/mongodb.adoc @@ -74,7 +74,7 @@ vectorStore.similaritySearch(SearchRequest.defaults() .withTopK(TOP_K) .withSimilarityThreshold(SIMILARITY_THRESHOLD) .withFilterExpression(b.and( - b.in("john", "jill"), + b.in("author", "john", "jill"), b.eq("article_type", "blog")).build())); ---- diff --git a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/vectordbs/neo4j.adoc b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/vectordbs/neo4j.adoc index b6c75cf4703..c6e9b6c23b2 100644 --- a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/vectordbs/neo4j.adoc +++ b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/vectordbs/neo4j.adoc @@ -159,7 +159,7 @@ vectorStore.similaritySearch(SearchRequest.defaults() .withTopK(TOP_K) .withSimilarityThreshold(SIMILARITY_THRESHOLD) .withFilterExpression(b.and( - b.in("john", "jill"), + b.in("author", "john", "jill"), b.eq("article_type", "blog")).build())); ---- diff --git a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/vectordbs/qdrant.adoc b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/vectordbs/qdrant.adoc index 9adc9e3eaf9..3b8caba0ab8 100644 --- a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/vectordbs/qdrant.adoc +++ b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/vectordbs/qdrant.adoc @@ -171,7 +171,7 @@ vectorStore.similaritySearch(SearchRequest.defaults() .withTopK(TOP_K) .withSimilarityThreshold(SIMILARITY_THRESHOLD) .withFilterExpression(b.and( - b.in("john", "jill"), + b.in("author", "john", "jill"), b.eq("article_type", "blog")).build())); ----