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

Chris M. Hostetter commented on LUCENE-10534:
---------------------------------------------

{quote}This is only needed when 0.0f is returned and need to determine if it is 
a valid value or the not found case.
{quote}
I'm almost certain this statement is not true? ... I don't believe there is 
anything in the {{FunctionValues}} API that implies/garuntees that {{floatVal}} 
(or {{doubleVal}} or {{intVal}} etc...) will have a specific value if 
{{exists}} is false.

Conisder something like (shorthand) 
{{sum(field("fieled_name_that_does_not_exist"),const(42))}} ... I'm almost 
certain that {{intVal()}} is  going to return 42 for every doc, but 
{{exists()}} will return {{false}} for every doc.  (and if you use a field that 
exists for some docs but not others, you'll get the expected {{intValue()}} + 
{{exists()}} value for each.

We could potentially harden the {{FunctionValues}} API so that the values 
methods *MUST* return "0" if {{exists()}} returns false -- but that would shift 
complexity from methods like the {{exists()}} impl of min/max to the {{func()}} 
methods of all MultiFloatFunction subclasses

> MinFloatFunction / MaxFloatFunction exists check can be slow
> ------------------------------------------------------------
>
>                 Key: LUCENE-10534
>                 URL: https://issues.apache.org/jira/browse/LUCENE-10534
>             Project: Lucene - Core
>          Issue Type: Improvement
>            Reporter: Kevin Risden
>            Assignee: Kevin Risden
>            Priority: Minor
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> MinFloatFunction 
> (https://github.com/apache/lucene/blob/main/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/MinFloatFunction.java)
>  and MaxFloatFunction 
> (https://github.com/apache/lucene/blob/main/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/MaxFloatFunction.java)
>  both check if values exist. This is needed since the underlying valuesource 
> returns 0.0f as either a valid value or as a value when the document doesn't 
> have a value.
> Even though this is changed to anyExists and short circuits in the case a 
> value is found in any document, the worst case is that there is no value 
> found and requires checking all the way through to the raw data. This is only 
> needed when 0.0f is returned and need to determine if it is a valid value or 
> the not found case.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

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

Reply via email to