Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

Add a note that tells cosine similarities are normalized (#2092)

Hakim1dfe095fd24f
diff --git a/solr/solr-ref-guide/modules/query-guide/pages/dense-vector-search.adoc b/solr/solr-ref-guide/modules/query-guide/pages/dense-vector-search.adoc
index 35f5f094c68..a165015837a 100644
--- a/solr/solr-ref-guide/modules/query-guide/pages/dense-vector-search.adoc
+++ b/solr/solr-ref-guide/modules/query-guide/pages/dense-vector-search.adoc
@@ -96,6 +96,9 @@ this similarity is intended as an optimized way to perform cosine similarity. In
* `cosine`: https://en.wikipedia.org/wiki/Cosine_similarity[Cosine similarity]
+[NOTE]
+the cosine similarity scores returned by Solr are normalized like this : `(1 + cosine_similarity) / 2`.
+
[NOTE]
the preferred way to perform cosine similarity is to normalize all vectors to unit length, and instead use DOT_PRODUCT. You should only use this function if you need to preserve the original vectors and cannot normalize them in advance.