Validating the expression to begin with, it doesn't work. Vector math
supports reading from an array of values so I tried the following
expression.

dotProduct(array(search(v9,
                                   q="id:1",
                                   fl="numeric_field_dfd",
                                   sort="numeric_field_dfd asc",
                                   qt="/export")),array(2))


where numeric_field_dfd - single valued dynamic field double type.  I tried
the multivalued double type assuming that it converts to an array of values
but it didn't work, so tried the single value to start with.

output of the expression is an exception -

[image: image.png]


The value is not null as seen below, so am I wrong in terms of expression
syntax then, any suggestions?


[image: image.png]



On Tue, May 30, 2023 at 4:47 PM rajani m <rajinima...@gmail.com> wrote:

> Hi Solr Users,
>
>    Does LTR Solr Feature
> <https://solr.apache.org/guide/8_7/learning-to-rank.html#feature-engineering> 
> support
> streaming expressions? Steaming expr supports vector math
> <https://solr.apache.org/guide/7_5/vector-math.html#dot-product-and-cosine-similarity>,
> I am trying to configure stream apis vector math as a solr feature which
> would fetch a vector from a document field and another from query param and
> compute cosine or dot product.
>
> For example, a LTR feature definition that would look like below, is this
> supported? Does LTR solr feature support parsing streaming api requests and
> its somewhat unique response that is not same as standard solr response?
>
>
> {
> "name": "vector_sim_score",
> "class": "org.apache.solr.ltr.feature.SolrFeature",
> "params": {
> "q": "expr=dotProduct(search(collection_name,q="id:$uniq_id",fl="doc_vector", 
> sort="from asc", qt="/export"), ${query_vector})"
> },
> "store": "v1_feature_store"
> }
>
>

Reply via email to