From c26bc557135111c0b4a8be60e36d0fecd232589d 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 e7ff7ac3e..948c0a2a8 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 58274443d..6ff1e8fa9 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 b6c75cf47..c6e9b6c23 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 9adc9e3ea..3b8caba0a 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())); ----