Skip to content

Commit

Permalink
Remove legacy feature that allows users to request additional facet f…
Browse files Browse the repository at this point in the history
…ields
  • Loading branch information
cbeer committed Jan 14, 2016
1 parent 5994c38 commit a5d7154
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 40 deletions.
10 changes: 0 additions & 10 deletions lib/blacklight/solr/search_builder_behavior.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,6 @@ def add_facet_fq_to_solr(solr_parameters)
# taking account of our facet paging/'more'. This is not
# about solr 'fq', this is about solr facet.* params.
def add_facetting_to_solr(solr_parameters)
# While not used by BL core behavior, legacy behavior seemed to be
# to accept incoming params as "facet.field" or "facets", and add them
# on to any existing facet.field sent to Solr. Legacy behavior seemed
# to be accepting these incoming params as arrays (in Rails URL with []
# on end), or single values. At least one of these is used by
# Stanford for "faux hieararchial facets".
if blacklight_params.has_key?("facet.field") || blacklight_params.has_key?("facets")
solr_parameters[:"facet.field"].concat( [blacklight_params["facet.field"], blacklight_params["facets"]].flatten.compact ).uniq!
end

facet_fields_to_include_in_request.each do |field_name, facet|
solr_parameters[:facet] ||= true

Expand Down
30 changes: 0 additions & 30 deletions spec/models/blacklight/solr/search_builder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,6 @@
it "should take q from request params" do
expect(subject[:q]).to eq "test query"
end

it "should add in extra facet.field from params" do
expect(subject[:"facet.field"]).to include("extra_facet")
end
end
end

Expand Down Expand Up @@ -333,32 +329,6 @@
config.add_facet_fields_to_solr_request!
end
end

context "user provides a single facet.field" do
let(:user_params) { { "facet.field" => "additional_facet" } }
it "adds the field" do
expect(subject[:"facet.field"]).to include("additional_facet")
expect(subject[:"facet.field"]).to have(2).fields
end
end

context "user provides a multiple facet.field" do
let(:user_params) { { "facet.field" => ["add_facet1", "add_facet2"] } }
it "adds the fields" do
expect(subject[:"facet.field"]).to include("add_facet1")
expect(subject[:"facet.field"]).to include("add_facet2")
expect(subject[:"facet.field"]).to have(3).fields
end
end

context "user provides a multiple facets" do
let(:user_params) { { "facets" => ["add_facet1", "add_facet2"] } }
it "adds the fields" do
expect(subject[:"facet.field"]).to include("add_facet1")
expect(subject[:"facet.field"]).to include("add_facet2")
expect(subject[:"facet.field"]).to have(3).fields
end
end
end
end

Expand Down

0 comments on commit a5d7154

Please sign in to comment.