Author: yonik
Date: Sun Dec  7 08:17:50 2008
New Revision: 724149

URL: http://svn.apache.org/viewvc?rev=724149&view=rev
Log:
normalize facet sort param

Modified:
    
lucene/solr/trunk/src/java/org/apache/solr/handler/component/FacetComponent.java

Modified: 
lucene/solr/trunk/src/java/org/apache/solr/handler/component/FacetComponent.java
URL: 
http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/handler/component/FacetComponent.java?rev=724149&r1=724148&r2=724149&view=diff
==============================================================================
--- 
lucene/solr/trunk/src/java/org/apache/solr/handler/component/FacetComponent.java
 (original)
+++ 
lucene/solr/trunk/src/java/org/apache/solr/handler/component/FacetComponent.java
 Sun Dec  7 08:17:50 2008
@@ -238,7 +238,7 @@
 
     for (DistribFieldFacet dff : fi.facets.values()) {
       if (dff.limit <= 0) continue; // no need to check these facets for 
refinement
-      if (dff.minCount <= 1 && (dff.sort.equals(FacetParams.FACET_SORT_LEX) || 
dff.sort.equals(FacetParams.FACET_SORT_LEX_LEGACY))) continue;
+      if (dff.minCount <= 1 && dff.sort.equals(FacetParams.FACET_SORT_LEX)) 
continue;
       ShardFacetCount[] counts = dff.getCountSorted();
       int ntop = Math.min(counts.length, dff.offset + dff.limit);
       long smallestCount = counts.length == 0 ? 0 : counts[ntop-1].count;
@@ -357,12 +357,12 @@
       facet_fields.add(dff.field, fieldCounts);
 
       ShardFacetCount[] counts;
-      if (dff.sort.equals(FacetParams.FACET_SORT_COUNT) || 
dff.sort.equals(FacetParams.FACET_SORT_COUNT_LEGACY)) {
+      if (dff.sort.equals(FacetParams.FACET_SORT_COUNT)) {
         counts = dff.countSorted;
         if (counts == null || dff.needRefinements) {
           counts = dff.getCountSorted();
         }
-      } else if (dff.sort.equals(FacetParams.FACET_SORT_LEX) || 
dff.sort.equals(FacetParams.FACET_SORT_LEX_LEGACY)) {
+      } else if (dff.sort.equals(FacetParams.FACET_SORT_LEX)) {
           counts = dff.getLexSorted();
       } else { // TODO: log error or throw exception?
           counts = dff.getLexSorted();
@@ -486,6 +486,11 @@
     this.missing = params.getFieldBool(field, FacetParams.FACET_MISSING, 
false);
     // default to sorting by count if there is a limit.
     this.sort = params.getFieldParam(field, FacetParams.FACET_SORT, limit>0 ? 
FacetParams.FACET_SORT_COUNT : FacetParams.FACET_SORT_LEX);
+    if (this.sort.equals(FacetParams.FACET_SORT_COUNT_LEGACY)) {
+      this.sort = FacetParams.FACET_SORT_COUNT;
+    } else if (this.sort.equals(FacetParams.FACET_SORT_LEX_LEGACY)) {
+      this.sort = FacetParams.FACET_SORT_LEX;
+    }
     this.prefix = params.getFieldParam(field,FacetParams.FACET_PREFIX);
   }
 }


Reply via email to