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

Adrien Grand commented on LUCENE-8718:
--------------------------------------

How different would it be from doing the following from the perspective of 
branch prediction? In the common case that there is only one value per 
document, we only have 2 methods calls (nextOrd() x2), like in your example 
(one call to nextOrd(), one call to docValueCount()), and one easy to predict 
condition?
{code:java}
long ord = values.nextOrd(); // there is at least one ord, otherwise 
next/advance would have skipped this doc or advanceExact would have returned 
false
long otherOrd = values.nextOrd();
if (otherOrd == NO_MORE_DOCS) { // this condition would evaluate to true most 
of the time, like (numVal == 1) in your example?
  // only one ord
} else {
  // multiple ords: loop through remaining ords
}
{code}

> Add docValueCount support for SortedSetDocValues
> ------------------------------------------------
>
>                 Key: LUCENE-8718
>                 URL: https://issues.apache.org/jira/browse/LUCENE-8718
>             Project: Lucene - Core
>          Issue Type: Improvement
>          Components: core/search
>    Affects Versions: 7.7.1
>            Reporter: John Wang
>            Priority: Major
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> implement docValueCount method for SortedSetDocValues, see comment:
>  
> [https://github.com/apache/lucene-solr/blob/master/lucene/core/src/java/org/apache/lucene/index/SortedSetDocValues.java#L54]
>  
> Patch/PR: https://github.com/apache/lucene-solr/pull/603



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to