spring-projects / spring-projects/spring-ai

Remove search condition from VectorStoreDocumentRetriever

Open
#2,067 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: waiting-for-triage
Dominant language
Java
Stars
9.5k
Forks
2.9k
Avg merge
1d 7h
Merged PRs (30d)
6

Description

public final class VectorStoreDocumentRetriever implements DocumentRetriever {

private final VectorStore vectorStore;

private final Double similarityThreshold;

private final Integer topK;

private final Supplier<Filter.Expression> filterExpression;

@Override
public List<Document> retrieve(Query query) {
	Assert.notNull(query, "query cannot be null");
	var searchRequest = SearchRequest.builder()
		.query(query.text())
		.filterExpression(this.filterExpression.get())
		.similarityThreshold(this.similarityThreshold)
		.topK(this.topK)
		.build();
	return this.vectorStore.similaritySearch(searchRequest);
}

}

I think that similarityThreshold\topK\filterExpression should be carried by Query. It can make VectorStoreDocumentRetriever be a singleton Object.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with VectorStoreDocumentRetriever and its retrieve(Query) method, then compare how Query, SearchRequest, and VectorStore are used in the surrounding code. Determine whether similarityThreshold, topK, and filterExpression should move onto Query and whether the retriever can become a singleton; done means the design is implemented consistently without changing retrieval behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
ai, backend-api-design
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.