Does solr use cosine similarity?

lucene, search-engine, solr

Solution

Yes, Solr (which runs on top of Lucene) does use Cosine similarity. From the Lucene documentation:

VSM score of document d for query q is the Cosine Similarity of the weighted query vectors V(q) and V(d)

cosine-similarity(q,d) = V(q) · V(d) / |V(q)| |V(d)|

https://lucene.apache.org/core/4_0_0/core/org/apache/lucene/search/similarities/TFIDFSimilarity.html

Problem

I have written a small search engine as my weekly project. It is based upon cosine similarity between query vector and document vector. Vector is calculate using of tf-idf sores of tokens. I have come to know about Apache Solr which is a full text search engine. My question is does solr use cosine similarity internally when rank search results?

Original source