You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by "Gabriel Magno (Jira)" <ji...@apache.org> on 2023/02/03 20:04:00 UTC

[jira] [Updated] (SOLR-16646) Create a new function query operator to verify if value is NaN (isnan)

     [ https://issues.apache.org/jira/browse/SOLR-16646?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gabriel Magno updated SOLR-16646:
---------------------------------
    Description: 
It would be useful to have a function query operator (e.g. `isnan`) to check rather a value is a float NaN (not a number).

Examples of use cases:
 * Filtering out resulting documents having NaN in a certain field or expression
 * Setting values and expressions according to the condition of a field/expression being NaN (`if(isnan(value),0,1)`)
 * Replacing NaN by a default value (similar as a coalesce): `if(isnan(value),0,value)`

This function/operator is particularly important considering that the cosine similarity calculated by KNN queries with Dense Vectors might return a NaN on the score depending on the vectors. For an example of a query returning NaN in the response (with the films example):

http://localhost:8983/solr/films/select?fl=id%2C%24similarity&q=*%3A*&similarity=%7B!knn%20f%3Dfilm_vector%20topK%3D10000%7D[0.0%2C0.0%2C0.0%2C0.0%2C0.0%2C0.0%2C0.0%2C0.0%2C0.0%2C0.0]&sort=%24similarity%20desc

  was:
It would be useful to have a function query operator (e.g. `isnan`) to check rather a value is a float NaN (not a number).

Examples of use cases:
 * Filtering out resulting documents having NaN in a certain field or expression
 * Setting values and expressions according to the condition of a field/expression being NaN (`if(isnan(value),0,1)`)
 * Replacing NaN by a default value (similar as a coalesce): `if(isnan(value),0,value)`

This function/operator is particularly important considering that the cosine similarity calculated by KNN queries with Dense Vectors might return a NaN on the score depending on the vectors. For an example of a query returning NaN in the response (with the films example):

http://localhost:8983/solr/films/select?fl=id%2C%24similarity&q=*%3A*&similarity=\{!knn f%3Dfilm_vector topK%3D10000}[0.0%2C0.0%2C0.0%2C0.0%2C0.0%2C0.0%2C0.0%2C0.0%2C0.0%2C0.0]&sort=%24similarity desc


> Create a new function query operator to verify if value is NaN (isnan)
> ----------------------------------------------------------------------
>
>                 Key: SOLR-16646
>                 URL: https://issues.apache.org/jira/browse/SOLR-16646
>             Project: Solr
>          Issue Type: New Feature
>      Security Level: Public(Default Security Level. Issues are Public) 
>          Components: query
>            Reporter: Gabriel Magno
>            Priority: Minor
>              Labels: FunctionQuery, operator
>
> It would be useful to have a function query operator (e.g. `isnan`) to check rather a value is a float NaN (not a number).
> Examples of use cases:
>  * Filtering out resulting documents having NaN in a certain field or expression
>  * Setting values and expressions according to the condition of a field/expression being NaN (`if(isnan(value),0,1)`)
>  * Replacing NaN by a default value (similar as a coalesce): `if(isnan(value),0,value)`
> This function/operator is particularly important considering that the cosine similarity calculated by KNN queries with Dense Vectors might return a NaN on the score depending on the vectors. For an example of a query returning NaN in the response (with the films example):
> http://localhost:8983/solr/films/select?fl=id%2C%24similarity&q=*%3A*&similarity=%7B!knn%20f%3Dfilm_vector%20topK%3D10000%7D[0.0%2C0.0%2C0.0%2C0.0%2C0.0%2C0.0%2C0.0%2C0.0%2C0.0%2C0.0]&sort=%24similarity%20desc



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

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