mirror of https://github.com/apache/lucene.git
LUCENE-3639: fix ShardSearchingTestBase bugs for stats accumulation
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1235772 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b6f3c1f911
commit
ad9969b9f7
|
@ -268,8 +268,19 @@ public abstract class ShardSearchingTestBase extends LuceneTestCase {
|
|||
assert subStats != null;
|
||||
}
|
||||
|
||||
docFreq += subStats.docFreq();
|
||||
totalTermFreq += subStats.totalTermFreq();
|
||||
int nodeDocFreq = subStats.docFreq();
|
||||
if (docFreq >= 0 && nodeDocFreq >= 0) {
|
||||
docFreq += nodeDocFreq;
|
||||
} else {
|
||||
docFreq = -1;
|
||||
}
|
||||
|
||||
long nodeTotalTermFreq = subStats.totalTermFreq();
|
||||
if (totalTermFreq >= 0 && nodeTotalTermFreq >= 0) {
|
||||
totalTermFreq += nodeTotalTermFreq;
|
||||
} else {
|
||||
totalTermFreq = -1;
|
||||
}
|
||||
}
|
||||
|
||||
return new TermStatistics(term.bytes(), docFreq, totalTermFreq);
|
||||
|
@ -299,9 +310,29 @@ public abstract class ShardSearchingTestBase extends LuceneTestCase {
|
|||
// Collection stats are pre-shared on reopen, so,
|
||||
// we better not have a cache miss:
|
||||
assert nodeStats != null: "myNodeID=" + myNodeID + " nodeID=" + nodeID + " version=" + nodeVersions[nodeID] + " field=" + field;
|
||||
docCount += nodeStats.docCount();
|
||||
sumTotalTermFreq += nodeStats.sumTotalTermFreq();
|
||||
sumDocFreq += nodeStats.sumDocFreq();
|
||||
|
||||
int nodeDocCount = nodeStats.docCount();
|
||||
if (docCount >= 0 && nodeDocCount >= 0) {
|
||||
docCount += nodeDocCount;
|
||||
} else {
|
||||
docCount = -1;
|
||||
}
|
||||
|
||||
long nodeSumTotalTermFreq = nodeStats.sumTotalTermFreq();
|
||||
if (sumTotalTermFreq >= 0 && nodeSumTotalTermFreq >= 0) {
|
||||
sumTotalTermFreq += nodeSumTotalTermFreq;
|
||||
} else {
|
||||
sumTotalTermFreq = -1;
|
||||
}
|
||||
|
||||
long nodeSumDocFreq = nodeStats.sumDocFreq();
|
||||
if (sumDocFreq >= 0 && nodeSumDocFreq >= 0) {
|
||||
sumDocFreq += nodeSumDocFreq;
|
||||
} else {
|
||||
sumDocFreq = -1;
|
||||
}
|
||||
|
||||
assert nodeStats.maxDoc() >= 0;
|
||||
maxDoc += nodeStats.maxDoc();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue