This class is probably your best bet: org.apache.lucene.index.VectorSimilarityFunction >From here you can explore the java code used to calculate the vector similarities in Apache Solr.
Cheers -------------------------- *Alessandro Benedetti* Director @ Sease Ltd. *Apache Lucene/Solr Committer* *Apache Solr PMC Member* e-mail: a.benede...@sease.io *Sease* - Information Retrieval Applied Consulting | Training | Open Source Website: Sease.io <http://sease.io/> LinkedIn <https://linkedin.com/company/sease-ltd> | Twitter <https://twitter.com/seaseltd> | Youtube <https://www.youtube.com/channel/UCDx86ZKLYNpI3gzMercM7BQ> | Github <https://github.com/seaseltd> On Sat, 27 Jan 2024 at 11:04, Frederic Font Corbera <frederic.f...@upf.edu> wrote: > Nevermind, I guess Solr computes cosine similarity and not cosine distance, > and the returned score is probably the cosine similarity value. > > Cheers, > > frederic > > > -- > Frederic Font - ffont.github.io > Music Technology Group, UPF - mtg.upf.edu <https://www.upf.edu/web/mtg/> > Freesound - freesound.org > > > > El ds, 27 gen. 2024 a les 11:57 Frederic Font Corbera < > frederic.f...@upf.edu> > va escriure: > > > Hi everyone, > > > > I successfully added dense vector search to my Solr-based app, but I’d > > like to compare the results with other nn-search solutions and for that > > reason it would be good to have access to the actual distance values > > computer by Solr. This does not seem to be possible and I can only access > > the resulting “score”. That score is of course related to the distance > > metric but I could not find information about how this relation works. In > > fact, cosine distance is, well, a distance metric (big values=dissimilar > > items), but the returned score is a “similarity” metric (big > values=similar > > items). So how does Solr transform the distance metric to a similarity > > metric? Is this documented somewhere? > > > > Thanks a lot! > > > > frederic > > > > > > -- > > Frederic Font - ffont.github.io > > Music Technology Group, UPF - mtg.upf.edu <https://www.upf.edu/web/mtg/> > > Freesound - freesound.org > > > > >