[ 
https://issues.apache.org/jira/browse/SOLR-6562?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14153532#comment-14153532
 ] 

Hoss Man commented on SOLR-6562:
--------------------------------


This is currently working as designed -- not a bug, but i've opened some 
realted improvement issues i've had in the back of my mind and your report 
reminded me.

the ValueSource implementations (the internals of function queries) support 
math operations on diff data types (int, long, float, double, etc...) 
corrisponding to the lowest level FieldType support in lucene DocValues (the 
same API as used by the FieldCache).

However: at present, there is no general purpose way to indicate which datatype 
you'd like to see used when doing math operations (neither from a bottom up 
"the source data is ints, so do int math" or a top down "i ultimately want a 
long, so do long math") standpoint.  

Since the primary purpose of function queries is to be used in boosting query 
scores, which are alreayd floating point -- that's what gets used at the moment.

bq. I'm using function queries to calculate dates. For example to add some 
hours to a date.

The "ms()" function is specifically designed to coerce millisecond based (long) 
math when subtraction on date fields like you are attempting in your original 
examples.  when combining the results of ms() inside of a "sm()" function that 
will still be done using floating point math by default however



> Function query calculates the wrong value
> -----------------------------------------
>
>                 Key: SOLR-6562
>                 URL: https://issues.apache.org/jira/browse/SOLR-6562
>             Project: Solr
>          Issue Type: Bug
>    Affects Versions: 4.9
>            Reporter: Stefan Neumüller
>            Priority: Critical
>
> This calculation 
> fl=sub(sum(abs(sub(1416906516710,1416783600000)),abs(sub(103680000000000,1416906516710))),102263216400000)
>  should return 0. But the calculated value is 8388608



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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

Reply via email to