Chris M. Hostetter created SOLR-17164:
-----------------------------------------

             Summary: Add 2 arg variant of vectorSimilarity() function
                 Key: SOLR-17164
                 URL: https://issues.apache.org/jira/browse/SOLR-17164
             Project: Solr
          Issue Type: Improvement
      Security Level: Public (Default Security Level. Issues are Public)
            Reporter: Chris M. Hostetter


Solr's current 4 argument 
{{vectorySimilarity(vectorEncoding,similarityFunction,vec1,vec2)}} function is 
really awkward to use for the (seemingly common) situation where you just want 
to know the similarity between a field and a constant vector, or (probably less 
common) between two fields of the same type.

The first two (currently) mandatory arguments to {{vectorySimilarity()}} 
({{{}vectorEncoding{}}} and {{{}similarityFunction{}}}) are already mandatory 
properties of {{{}DenseVectorField{}}}. IIUC the only reason these arguments 
are required is in the (seemingly uncommon?) situation where you might want to 
compute the similarity of two vector constants, so the function needs to know 
what {{vectorEncoding}} and {{similarityFunction}} to use.

 
----
 

It would be really nice to support a simplified 2 argument variant of 
{{vectorySimilarity()}} such that:
 * the first argument must be the name of a {{DenseVectorField}} field
 * the second argument must be either:
 ** A vector constant
 *** in which case the {{vectorEncoding}} use to parse the constant is infered 
from the fieldType properties of the first argument
 ** Or the name of a second {{DenseVectorField}} field
 *** in which case the {{vectorEncoding}} and {{similarityFunction}} of the two 
fields must match
 * The ValueSource returned should be based on the configured 
{{vectorEncoding}} & {{similarityFunction}} of the field(s)

Examples...
{noformat}
vectorySimilarity(title_float_vec_dim4, [1.0,2.0,3.0,4.0])

   ...or...

vectorySimilarity(title_float_vec_dim4, body_float_vec_dim4)
{noformat}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to