Skip to content

Commit

Permalink
Merge pull request #1126 from awead/rsolr-dep
Browse files Browse the repository at this point in the history
Use RSolr.solr_escape in place of ::escape
  • Loading branch information
cbeer committed Mar 6, 2015
2 parents 4afa685 + 3fd2644 commit f81f3ec
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion blacklight.gemspec
Expand Up @@ -20,7 +20,7 @@ Gem::Specification.new do |s|
s.add_dependency "rails", ">= 3.2.6", "< 5"
s.add_dependency "nokogiri", "~>1.6" # XML Parser
s.add_dependency "kaminari", "~> 0.13" # the pagination (page 1,2,3, etc..) of our search results
s.add_dependency "rsolr", "~> 1.0.6" # Library for interacting with rSolr.
s.add_dependency "rsolr", "~> 1.0.11" # Library for interacting with rSolr.
s.add_dependency "bootstrap-sass", "~> 3.2"
s.add_dependency "deprecation"

Expand Down
8 changes: 4 additions & 4 deletions lib/blacklight/solr/search_builder.rb
Expand Up @@ -241,13 +241,13 @@ def facet_value_to_fq_string(facet_field, value)
facet_config.query[value][:fq]
when (facet_config and facet_config.date)
# in solr 3.2+, this could be replaced by a !term query
"#{prefix}#{facet_field}:#{RSolr.escape(value)}"
"#{prefix}#{facet_field}:#{RSolr.solr_escape(value)}"
when (value.is_a?(DateTime) or value.is_a?(Date) or value.is_a?(Time))
"#{prefix}#{facet_field}:#{RSolr.escape(value.to_time.utc.strftime("%Y-%m-%dT%H:%M:%SZ"))}"
"#{prefix}#{facet_field}:#{RSolr.solr_escape(value.to_time.utc.strftime("%Y-%m-%dT%H:%M:%SZ"))}"
when (value.is_a?(TrueClass) or value.is_a?(FalseClass) or value == 'true' or value == 'false'),
(value.is_a?(Integer) or (value.to_i.to_s == value if value.respond_to? :to_i)),
(value.is_a?(Float) or (value.to_f.to_s == value if value.respond_to? :to_f))
"#{prefix}#{facet_field}:#{RSolr.escape(value.to_s)}"
"#{prefix}#{facet_field}:#{RSolr.solr_escape(value.to_s)}"
when value.is_a?(Range)
"#{prefix}#{facet_field}:[#{value.first} TO #{value.last}]"
else
Expand All @@ -261,4 +261,4 @@ def grouped_key_for_results
blacklight_config.index.group
end
end
end
end
4 changes: 2 additions & 2 deletions spec/lib/blacklight/solr/search_builder_spec.rb
Expand Up @@ -370,11 +370,11 @@
end

it "should pass floats through" do
expect(subject.send(:facet_value_to_fq_string, "facet_name", 1.11)).to eq "facet_name:1\\.11"
expect(subject.send(:facet_value_to_fq_string, "facet_name", 1.11)).to eq "facet_name:1.11"
end

it "should pass floats through" do
expect(subject.send(:facet_value_to_fq_string, "facet_name", "1.11")).to eq "facet_name:1\\.11"
expect(subject.send(:facet_value_to_fq_string, "facet_name", "1.11")).to eq "facet_name:1.11"
end

it "should escape negative integers" do
Expand Down

0 comments on commit f81f3ec

Please sign in to comment.