Skip to content

Commit

Permalink
using uber_properties
Browse files Browse the repository at this point in the history
  • Loading branch information
lsat12357 committed Sep 18, 2015
1 parent be9dcfb commit 2fe3f32
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 19 deletions.
5 changes: 5 additions & 0 deletions app/models/blacklight_config/facet_fields.rb
Expand Up @@ -6,6 +6,11 @@ def run
facet_fields.each do |field|
configuration.add_facet_field ActiveFedora::SolrQueryBuilder.solr_name(field.key, :symbol), :label => field.view_label
end
FacetGroup.uber_properties.each do |property|
property.each do |key,val|
configuration.add_facet_field Solrizer.solr_name(key.to_s, :symbol), :label => val
end
end
configuration.add_facet_fields_to_solr_request!
end

Expand Down
1 change: 0 additions & 1 deletion app/models/blacklight_config/index_configuration.rb
Expand Up @@ -5,7 +5,6 @@ def run
configuration.index.title_field = Solrizer.solr_name('title', :symbol).to_s
configuration.add_index_field Solrizer.solr_name('date', :symbol), :label => 'Date'
configuration.add_index_field Solrizer.solr_name('description', :symbol), :label => 'Description'

configuration.add_index_field "full_text_tsimv", :label => "Full Text", :highlight => true
end
end
Expand Down
12 changes: 11 additions & 1 deletion app/models/facet_group.rb
Expand Up @@ -3,8 +3,9 @@ class FacetGroup < DataModel
property :creator, :uberfield => :ubercreator
property :contributor, :uberfield => :ubercreator
property :author, :uberfield => :ubercreator
property :spatial, :uberfield => :ubergeographic

#override?

def simple_properties
end

Expand All @@ -16,4 +17,13 @@ def self.ssim(symbol)
symbol.to_s + "_ssim"
end


def self.uber_properties
uber_properties ||= []
properties.group_by{|property| property.uberfield}.each do |key, val|
uber_properties << Hash[key => "All " + key.to_s.gsub('uber',"").capitalize + " types"]
end
uber_properties
end

end
1 change: 0 additions & 1 deletion app/models/od_data_model.rb
Expand Up @@ -26,7 +26,6 @@ class ODDataModel < DataModel
property :transcriber, :predicate => OregonDigital::Vocabularies::MARCREL.trc
property :creatorDisplay, :predicate => OregonDigital::Vocabularies::OPAQUENAMESPACE['cco/creatorDisplay']
property :collector, :predicate => OregonDigital::Vocabularies::MARCREL.col
property :uberCreator, :predicate => RDF::DC11.creator

# Descriptions
property :description, :predicate => RDF::DC.description
Expand Down
3 changes: 2 additions & 1 deletion spec/models/blacklight_config_spec.rb
Expand Up @@ -84,13 +84,14 @@
it "should have facets for all the facet fields" do
FacetField.create(:key => "title")
FacetField.create(:key => "test", :label => "Power Rangers")

keys = subject.facet_fields.values.map(&:key)
labels = subject.facet_fields.values.map(&:label)
expect(keys).to include "title_ssim"
expect(labels).to include "Title"
expect(keys).to include "test_ssim"
expect(labels).to include "Power Rangers"
expect(keys).to include "ubercreator_ssim"
expect(labels).to include "All Creator types"
end

it "should have a tool config for edit" do
Expand Down
15 changes: 0 additions & 15 deletions spec/models/facet_group_spec.rb

This file was deleted.

0 comments on commit 2fe3f32

Please sign in to comment.