diff --git a/common/src/main/java/com/tencent/supersonic/common/service/impl/EmbeddingServiceImpl.java b/common/src/main/java/com/tencent/supersonic/common/service/impl/EmbeddingServiceImpl.java index b0e89b9b4..df71dc11e 100644 --- a/common/src/main/java/com/tencent/supersonic/common/service/impl/EmbeddingServiceImpl.java +++ b/common/src/main/java/com/tencent/supersonic/common/service/impl/EmbeddingServiceImpl.java @@ -79,15 +79,12 @@ private boolean existSegment(EmbeddingStore embeddingStore, TextSegment query, E Map filterCondition = new HashMap<>(); filterCondition.put(TextSegmentConvert.QUERY_ID, queryId); Filter filter = createCombinedFilter(filterCondition); - EmbeddingSearchRequest request = EmbeddingSearchRequest.builder() - .queryEmbedding(embedding).filter(filter).maxResults(1).build(); + .queryEmbedding(embedding).filter(filter).minScore(1.0d).maxResults(1).build(); EmbeddingSearchResult result = embeddingStore.search(request); List> relevant = result.matches(); - boolean exists = CollectionUtils.isNotEmpty(relevant); - cache.put(queryId, exists); return exists; } @@ -126,10 +123,8 @@ public List retrieveQuery(String collectionName, RetrieveQu Filter filter = createCombinedFilter(filterCondition); EmbeddingSearchRequest request = EmbeddingSearchRequest.builder() .queryEmbedding(embeddedText).filter(filter).maxResults(num).build(); - EmbeddingSearchResult result = embeddingStore.search(request); List> relevant = result.matches(); - RetrieveQueryResult retrieveQueryResult = new RetrieveQueryResult(); retrieveQueryResult.setQuery(queryText); List retrievals = new ArrayList<>(); @@ -154,7 +149,6 @@ public List retrieveQuery(String collectionName, RetrieveQu retrieveQueryResult.setRetrieval(retrievals); results.add(retrieveQueryResult); } - return results; }