solr icon indicating copy to clipboard operation
solr copied to clipboard

SOLR-17164: Add 2 arg variant of vectorSimilarity() function

Open iamsanjay opened this issue 1 year ago • 0 comments

https://issues.apache.org/jira/browse/SOLR-17164

Introducing 2 arg variant of vectorSimilarity function query.

vectorSimilarity(vector1, vector2)

This function accepts two vectors as input: The first argument must be a Knn vector, and the second argument can be either a Knn vector or a constant vector. The function automatically deduces the Vector Encoding and Similarity function from the properties of the first Knn vector.

Syntax Examples

  • vectorSimilarity(vectorField1, vectorField2): calculates the similarity between vector field 'vectorField1' and 'vectorField2'
  • vectorSimilarity(vectorField1, [1, 2, 3, 4]): calculates the similarity between vector field 'vectorField1' and [1, 2, 3, 4]

Checklist

Please review the following and check all that apply:

  • [x] I have reviewed the guidelines for How to Contribute and my code conforms to the standards described there to the best of my ability.
  • [x] I have created a Jira issue and added the issue ID to my pull request title.
  • [x] I have given Solr maintainers access to contribute to my PR branch. (optional but recommended)
  • [x] I have developed this patch against the main branch.
  • [ ] I have run ./gradlew check.
  • [x] I have added tests for my changes.
  • [x] I have added documentation for the Reference Guide

iamsanjay avatar Feb 22 '24 11:02 iamsanjay