Skip to content

Commit

Permalink
Allow enriched properties to be searched against
Browse files Browse the repository at this point in the history
  • Loading branch information
Trey Terrell committed Jun 26, 2015
1 parent 7213b4b commit 8a71fc2
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
16 changes: 15 additions & 1 deletion app/models/blacklight_config/search_field.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,22 @@ def solr_parameters
if opts[:qf]
{:qf => opts[:qf]}
else
{:qf => Solrizer.solr_name(key, :stored_searchable) }
{:qf => all_properties.map(&:property_key)}
end
end

private

def all_properties
[property] | property.derivative_properties.values
end

def property
@property ||= SolrProperty.new(solr_name)
end

def solr_name
Solrizer.solr_name(key, :stored_searchable)
end
end
end
7 changes: 6 additions & 1 deletion spec/models/blacklight_config/search_field_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@
end
context "by default" do
it "should set qf" do
expect(subject.solr_parameters).to eq ({:qf => Solrizer.solr_name(field, :stored_searchable)})
qf = subject.solr_parameters[:qf]
expect(qf).to include Solrizer.solr_name(field, :stored_searchable)
end
it "should add derivative keys" do
qf = subject.solr_parameters[:qf]
expect(qf).to include Solrizer.solr_name(field+"_preferred_label", :stored_searchable)
end
end
end
Expand Down

0 comments on commit 8a71fc2

Please sign in to comment.