app/models/spotlight/field_metadata.rb in blacklight-spotlight-2.13.0 vs app/models/spotlight/field_metadata.rb in blacklight-spotlight-3.0.0.alpha.1
- old
+ new
@@ -4,10 +4,12 @@
##
# Expose Solr index metadata about fields
class FieldMetadata
FACET_LIMIT = 20
+ include Spotlight::SearchHelper
+
attr_reader :exhibit, :repository, :blacklight_config
def initialize(exhibit, repository, blacklight_config)
@exhibit = exhibit
@repository = repository
@@ -21,28 +23,20 @@
terms: terms.fetch(field_name(key), [])
}
end
def search_params
- search_builder.merge(rows: 0, 'facet.limit' => FACET_LIMIT + 1)
+ search_service.search_builder.merge(rows: 0, 'facet.limit' => FACET_LIMIT + 1)
end
private
def field_name(key)
if blacklight_config.facet_fields[key]
blacklight_config.facet_fields[key].field
else
key
end
- end
-
- def search_builder_class
- blacklight_config.search_builder_class
- end
-
- def search_builder
- search_builder_class.new(self)
end
def solr_response
@solr_response ||= repository.search(search_params.merge('facet.query' => facet_fields.map { |_key, fields| "#{fields.field}:[* TO *]" },
'rows' => 0,