Skip to content

Explore Search Results #4960

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: 5.0.x
Choose a base branch
from
Open

Explore Search Results #4960

wants to merge 8 commits into from

Conversation

mp911de
Copy link
Member

@mp911de mp911de commented May 5, 2025

Return SearchResult from Repository Query methods.

Depends on spring-projects/spring-data-commons#3285

@mp911de mp911de added the type: enhancement A general enhancement label May 5, 2025
@mp911de mp911de added this to the 5.0 M3 (2025.1.0) milestone May 5, 2025
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems to have ended up in the wrong directory. should have been src/test/java, right?

Comment on lines 56 to 60
* Configuration whether to use ANN or ENN for the search. ANN is the default.
*
* @return the search type to use.
*/
VectorSearchOperation.SearchType searchType() default VectorSearchOperation.SearchType.ENN;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Documentation (default: ANN) contradicted by implementation (default: ENN).
MongoDB itself will use ANN by default (so the doc) is closer to what happens than the actual default value.

I think the MongoDB restrictions here do not allow much flexibility regarding defaulting of values. Like on the one hand ANN ist stated as default but requires numCandidates while the exact flag is labelled optional.

We could argue DEFAULT is a viable option here. Checking the numCandidates attribute, using ENN if no value present, ANN otherwise.

* @author Mark Paluch
* @since 5.0
*/
class VectorSearchExecution implements MongoQueryExecution {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

curious if we can derive a more AOT friendly variant of this.

if (query.isLimited()) {
limit = query.getLimit();
} else {
limit = Math.max(1, numCandidates() != null ? numCandidates() / 20 : 1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

limit cannot exceed numCandidates and numCandidates should be at least 20x higher than limit but is deriving the limit the way it's done here valid?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably doesn't make sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants