app/models/spotlight/field_metadata.rb in blacklight-spotlight-0.34.1 vs app/models/spotlight/field_metadata.rb in blacklight-spotlight-1.0.0.alpha1
- old
+ new
@@ -10,22 +10,30 @@
@exhibit = exhibit
@repository = repository
@blacklight_config = blacklight_config
end
- def field(field_name)
+ def field(key)
{
- document_count: document_counts.fetch(field_name, 0),
- value_count: terms.fetch(field_name, []).length,
- terms: terms.fetch(field_name, [])
+ document_count: document_counts.fetch(field_name(key), 0),
+ value_count: terms.fetch(field_name(key), []).length,
+ terms: terms.fetch(field_name(key), [])
}
end
def search_params
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