spring-projects / spring-projects/spring-ai
Remove search condition from VectorStoreDocumentRetriever
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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