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-59692: Respect choice of similarity metric, bleve_index_api@v1.1.3 #182

Merged
merged 2 commits into from
Nov 17, 2023

Conversation

abhinavdangeti
Copy link
Member

No description provided.

@abhinavdangeti abhinavdangeti changed the title Respecting choice of similarity metric, upgrade to bleve_index_api@v1.1.3 MB-59692: Respect choice of similarity metric, bleve_index_api@v1.1.3 Nov 16, 2023
@@ -368,10 +368,15 @@ func (vo *vectorIndexOpaque) writeVectorIndexes(w *CountHashWriter) (offset uint
ids = append(ids, int64(hash))
}

var metric = faiss.MetricL2
if content.metric == index.CosineSimilarity {
Copy link
Member

Choose a reason for hiding this comment

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

i feel like it would be a lot cleaner if we declare the map in the bleve_index_api domain as:

var SupportedSimilarityMetrics = map[string]int{
	EuclideanDistance: faiss.MetricL2,
	CosineSimilarity:  faiss.MetricInnerProduct,
}

over here what we could do is pass the index.SupportedSimilarityMetrics[metric] value to the factory method

Copy link
Member Author

Choose a reason for hiding this comment

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

Ya I thought about doing that earlier, but perhaps is not a good idea to pollute the generic bleve_index_api with implementation specifics - referring to go-faiss here, in case we decide to embed a different better performing vector index in the future.

@abhinavdangeti abhinavdangeti merged commit 6b9b047 into master Nov 17, 2023
6 checks passed
@abhinavdangeti abhinavdangeti deleted the metric branch November 17, 2023 15:58
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.

2 participants