Is it possible to return the values ​​of the solr function (not salt or document fields)?

We make a solr request where we provide a custom function (which is rather complicated) and sort the results by the value of this function. The query looks something like this:

solr/select?customFunc=complexFunction(querySpecificValue1,querySpecificValue2)&sort_by=$customFunc&fq=...... 

Our understanding is that we can only return the fields to the document and return the solr back from solr. Can someone tell us if and how we can get the calculated customFunc value for each document. For some reason, we cannot set the solr value to customFunc.

+6
source share
2 answers

You should use the fl parameter to select pseudo-fields, functions, etc., but this is only supported on the external line that will be released with Solr 4.0. Check out the CommonQueryParameters wiki page . The problem of SOLR-2444 can be interesting.

A brief example:

 solr/select?q=*:*&fl=*,customFunc:complexFunction(querySpecificValue1,querySpecificValue2) 
+5
source

It helps me:

 /solr/auction-En/select/?q=*:*_val_:"sum(x,y)"&debugQuery=true&version=2.2&start=0&rows=10&indent=on&fl=*,score 

You will see the function values ​​in the debugging part.

0
source

Source: https://habr.com/ru/post/911398/


All Articles