Skip to content

Commit

Permalink
Merge pull request #4671 from pulibrary/allow_language_facet_in_facet…
Browse files Browse the repository at this point in the history
…_suggest_query

Don't filter out non-home facets on facet suggest searches
  • Loading branch information
sandbergja authored Jan 1, 2025
2 parents f4cfae3 + 6105eec commit b144c8a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/search_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def search_query_present?
end

def facet_query_present?
blacklight_params[:f].present?
blacklight_params[:f].present? || blacklight_params[:action] == 'facet'
end

def json_query_dsl_clauses
Expand Down
9 changes: 9 additions & 0 deletions spec/models/search_builder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,15 @@
expect { search_builder.only_home_facets(solr_parameters) }.not_to change { solr_parameters }
end
end
context 'when there is a facet suggest query' do
let(:blacklight_params) do
{ "controller" => "catalog", "action" => "facet", "id" => "language_facet", "query_fragment" => "a", "only_values" => true }.with_indifferent_access
end
it 'does not make any changes to the facets' do
solr_parameters = { 'facet.field' => ['access_facet', 'language_facet'] }
expect { search_builder.only_home_facets(solr_parameters) }.not_to change { solr_parameters }
end
end
end

describe '#adjust_mm' do
Expand Down

0 comments on commit b144c8a

Please sign in to comment.