You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-commits@lucene.apache.org by yo...@apache.org on 2007/09/08 03:38:26 UTC

svn commit: r573770 - in /lucene/solr/trunk: CHANGES.txt src/java/org/apache/solr/request/SimpleFacets.java

Author: yonik
Date: Fri Sep  7 18:38:23 2007
New Revision: 573770

URL: http://svn.apache.org/viewvc?rev=573770&view=rev
Log:
SOLR-348: short-circuit faceting if less than mincount docs match

Modified:
    lucene/solr/trunk/CHANGES.txt
    lucene/solr/trunk/src/java/org/apache/solr/request/SimpleFacets.java

Modified: lucene/solr/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/CHANGES.txt?rev=573770&r1=573769&r2=573770&view=diff
==============================================================================
--- lucene/solr/trunk/CHANGES.txt (original)
+++ lucene/solr/trunk/CHANGES.txt Fri Sep  7 18:38:23 2007
@@ -136,6 +136,8 @@
     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)

Modified: lucene/solr/trunk/src/java/org/apache/solr/request/SimpleFacets.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/request/SimpleFacets.java?rev=573770&r1=573769&r2=573770&view=diff
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/request/SimpleFacets.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/request/SimpleFacets.java Fri Sep  7 18:38:23 2007
@@ -248,7 +248,7 @@
 
     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 @@
     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 @@
         }
       }
     } while (te.next());
+    }
 
     if (sort) {
       for (CountPair<String,Integer> p : queue) {