From faeb3f9a30656439b7ad578085edab32d2c239e7 Mon Sep 17 00:00:00 2001
From: Demian Katz <demian.katz@villanova.edu>
Date: Fri, 16 Oct 2015 12:14:10 -0400
Subject: [PATCH] More consistent facet sorting behavior. - Don't worry about
 default Solr behavior; now that we have sorted_by_index setting, we should
 always use count when index is not set. - Resolves VUFIND-1128.

---
 module/VuFind/src/VuFind/Search/Solr/Params.php | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/module/VuFind/src/VuFind/Search/Solr/Params.php b/module/VuFind/src/VuFind/Search/Solr/Params.php
index e76bc991e39..57b371de6c2 100644
--- a/module/VuFind/src/VuFind/Search/Solr/Params.php
+++ b/module/VuFind/src/VuFind/Search/Solr/Params.php
@@ -188,15 +188,7 @@ class Params extends \VuFind\Search\Base\Params
             if ($this->facetPrefix != null) {
                 $facetSet['prefix'] = $this->facetPrefix;
             }
-            if ($this->facetSort != null) {
-                $facetSet['sort'] = $this->facetSort;
-            } else {
-                // No explicit setting? Set one based on the documented Solr behavior
-                // (index order for limit = -1, count order for limit > 0)
-                // Later Solr versions may have different defaults than earlier ones,
-                // so making this explicit ensures consistent behavior.
-                $facetSet['sort'] = ($this->facetLimit > 0) ? 'count' : 'index';
-            }
+            $facetSet['sort'] = $this->facetSort ?: 'count';
             if ($this->indexSortedFacets != null) {
                 foreach ($this->indexSortedFacets as $field) {
                     $facetSet["f.{$field}.facet.sort"] = 'index';
-- 
GitLab