[
https://issues.apache.org/jira/browse/LUCENE-10534?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17527778#comment-17527778
]
Chris M. Hostetter commented on LUCENE-10534:
---------------------------------------------
Maybe a diff approach to speeding up these types of impls would be a new
alterantive to {{MultiFunction.anyExists}} that callers could use to eliminate
their own need to check exists on the sub-values? ...
{code}
public static boolean someExists(int doc, FunctionValues[] values, boolean[]
whoExists) throws IOException {
boolean someoneExists = false;
for (int i = 0; i < values.length; i++) {
whoExists[i] = false;
if (values[i].exists(doc)) {
someoneExists = true;
whoExists[i] = true;
}
}
return someoneExists;
}
{code}
...and then methods like {{MinFloatFunction.func}} can call {{someExists(...)}
(instead of {{this.exists(...)}}) to restrict which (if any) of the {{valsArr)
are candidates for being the min value (w/o needing to redundently call
{{vals.exists(doc)}} on each o them again)
?
> 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: [email protected]
For additional commands, e-mail: [email protected]