SOLR-348: short-circuit faceting if less than mincount docs match

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@573770 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yonik Seeley 2007-09-08 01:38:23 +00:00
parent 112796dd03
commit 1ce8c6feb3
2 changed files with 6 additions and 1 deletions

View File

@ -136,6 +136,8 @@ Optimizations
which flushes deleted without forcing the user to use <commit/> for this purpose.
(klaas)
3. SOLR-348: short-circuit faceting if less than mincount docs match. (yonik)
Bug Fixes
1. Make TextField respect sortMissingFirst and sortMissingLast fields.
(J.J. Larrea via yonik)

View File

@ -248,7 +248,7 @@ public class SimpleFacets {
final int nTerms=endTermIndex-startTermIndex;
if (nTerms>0) {
if (nTerms>0 && docs.size() >= mincount) {
// count collection array only needs to be as big as the number of terms we are
// going to collect counts for.
@ -351,6 +351,8 @@ public class SimpleFacets {
String startTerm = prefix==null ? "" : ft.toInternal(prefix);
TermEnum te = r.terms(new Term(field,startTerm));
TermDocs td = r.termDocs();
if (docs.size() >= mincount) {
do {
Term t = te.term();
@ -392,6 +394,7 @@ public class SimpleFacets {
}
}
} while (te.next());
}
if (sort) {
for (CountPair<String,Integer> p : queue) {