Skip to content
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

MB-57926 - Searcher for similarity search #1849

Conversation

metonymic-smokey
Copy link
Member

No description provided.

index_impl.go Outdated
searchQuery := req.Query
if req.Similarity != nil {
similarityQuery := query.NewSimilarityQuery(req.Similarity.Vector)
similarityQuery.SetFieldVal(req.Similarity.Field)
Copy link
Member

Choose a reason for hiding this comment

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

I'm thinking if it makes sense to have this as a set of fields instead, and what you're trying to do is apply the similarity search over each of those fields. So, you'd be getting the similar vectors from all these indexed fields and do a conjunction of these sub-similarity searchers and the user's non-similarity query.

Copy link
Member Author

Choose a reason for hiding this comment

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

As per discussion, the user can enter multiple fields, not just one.

Copy link
Member Author

Choose a reason for hiding this comment

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

@abhinavdangeti do you think it's a valid use case where the user enters multiple fields against 1 vector?
@Thejas-bhat mentioned that a user could have multiple fields with dense vector content and might want to query the same vector across them and hence, the need for multiple fields.

search.go Outdated
@@ -282,9 +282,16 @@ type SearchRequest struct {
SearchAfter []string `json:"search_after"`
SearchBefore []string `json:"search_before"`

Similarity *SimilarityRequest `json:"similarity"`
Copy link
Member Author

Choose a reason for hiding this comment

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

Is Similarity an appropriate name?

Copy link
Member Author

Choose a reason for hiding this comment

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

should be vector-specific.

Copy link
Member

Choose a reason for hiding this comment

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

Let's use kNN everywhere - KNNSearcher, kNNMatch etc.

@metonymic-smokey metonymic-smokey force-pushed the similarity branch 3 times, most recently from ecc4bd7 to 4f02605 Compare July 28, 2023 07:58
@metonymic-smokey metonymic-smokey marked this pull request as draft August 8, 2023 09:18
@metonymic-smokey metonymic-smokey force-pushed the similarity branch 5 times, most recently from 46d693a to a3de9ff Compare August 9, 2023 06:53
@metonymic-smokey metonymic-smokey changed the base branch from master to add_dense_vector_data_type_with_build_flags August 9, 2023 10:40
@metonymic-smokey metonymic-smokey force-pushed the similarity branch 2 times, most recently from 7c112f4 to b6fa9b5 Compare August 9, 2023 11:21
@abhinavdangeti
Copy link
Member

@metonymic-smokey proposing a few changes around score/boost for searcher that will be relevant here in the spec. Let's catch up tomorrow.

}
}
}
}
Copy link
Member

Choose a reason for hiding this comment

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

i think you might need to check the default mapping for the path as well (if the type mappings don't have the path in it). just like how AnalyzerNameForPath(paht string) does

@@ -55,4 +55,6 @@ type IndexMapping interface {

AnalyzerNameForPath(path string) string
AnalyzerNamed(name string) analysis.Analyzer

FieldMappingForPath(path string) *FieldMapping
Copy link
Member

Choose a reason for hiding this comment

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

perhaps its better to not return a pointer to the fieldMapping. mainly because i think this interface deals with reading of the content in the index mapping, and passing a pointer to the fieldMapping could lead to users having the option to modify the config of the field mapping at instances when they aren't allowed to do so (for example query time).

@abhinavdangeti
Copy link
Member

Closing in favor of #1869

@abhinavdangeti abhinavdangeti removed this from the v2.4.0 milestone Mar 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants