Skip to content

Commit

Permalink
solr_facet_params defaults to sort=index
Browse files Browse the repository at this point in the history
  • Loading branch information
jrochkind committed Aug 21, 2014
1 parent 61f0603 commit d90c4f2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/blacklight/solr_helper.rb
Expand Up @@ -224,7 +224,7 @@ def solr_facet_params(facet_field, user_params=params || {}, extra_controller_pa
# override any field-specific default in the solr request handler.
solr_params[:"f.#{facet_field}.facet.limit"] = limit + 1
solr_params[:"f.#{facet_field}.facet.offset"] = ( input.fetch(Blacklight::Solr::FacetPaginator.request_keys[:page] , 1).to_i - 1 ) * ( limit )
solr_params[:"f.#{facet_field}.facet.sort"] = input[ Blacklight::Solr::FacetPaginator.request_keys[:sort] ] if input[ Blacklight::Solr::FacetPaginator.request_keys[:sort] ]
solr_params[:"f.#{facet_field}.facet.sort"] = input[ Blacklight::Solr::FacetPaginator.request_keys[:sort] ] || "index"
solr_params[:rows] = 0

return solr_params
Expand Down
4 changes: 4 additions & 0 deletions spec/lib/blacklight/solr_helper_spec.rb
Expand Up @@ -663,6 +663,10 @@ def logger
solr_params = subject.solr_facet_params(@facet_field)
expect(solr_params[:"f.#{@facet_field}.facet.limit"]).to eq 21
end
it "defaults sort to index" do
solr_params = subject.solr_facet_params(@facet_field)
expect(solr_params[:"f.#{@facet_field}.facet.sort"]).to eq "index"
end

describe 'if facet_list_limit is defined in controller' do
before do
Expand Down

0 comments on commit d90c4f2

Please sign in to comment.