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

Andrzej Bialecki  commented on LUCENE-3722:
-------------------------------------------

I think the add() methods as implemented in this patch are of limited 
usefulness... The reason I created a pair of similar classes in SOLR-1632 was 
to avoid creating new objects by allowing modification of int/long members in 
place, which is useful when aggregating partial stats. So I think a more useful 
implementation of add() could look like this:

{code}
public void add(CollectionStatistics other) {
  assert this.field.equals(other.field);
  this.maxDoc += other.maxDoc;
  this.docCount += other.docCount;
  this.sumTotalTermFreq += other.sumTotalTermFreq;
  this.sumDocFreq += other.sumDocFreq;
}
{code}

Regarding the handling of -1: this code doesn't handle the case when only one 
stats is -1, which may happen in distributed scenario. I think in such case a 
-1 value should be treated as 0, i.e. it should not "reset" the accumulated 
value from other shards to -1, right?
                
> make similarities/term/collectionstats take long (for > 2B docs)
> ----------------------------------------------------------------
>
>                 Key: LUCENE-3722
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3722
>             Project: Lucene - Java
>          Issue Type: Improvement
>    Affects Versions: 4.0
>            Reporter: Robert Muir
>         Attachments: LUCENE-3722.patch, LUCENE-3722.patch
>
>
> As noted by Yonik and Andrzej on SOLR-1632, this would be useful for 
> distributed scoring.
> we can also add a sugar method add() to both of these to make it easier to 
> sum.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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

Reply via email to