Class: Spotlight::FieldMetadata
- Inherits:
-
Object
- Object
- Spotlight::FieldMetadata
- Defined in:
- app/models/spotlight/field_metadata.rb
Overview
Expose Solr index metadata about fields
Instance Attribute Summary collapse
-
#blacklight_config ⇒ Object
readonly
Returns the value of attribute blacklight_config.
-
#repository ⇒ Object
readonly
Returns the value of attribute repository.
Instance Method Summary collapse
- #field(field_name) ⇒ Object
-
#initialize(repository, blacklight_config) ⇒ FieldMetadata
constructor
A new instance of FieldMetadata.
Constructor Details
#initialize(repository, blacklight_config) ⇒ FieldMetadata
Returns a new instance of FieldMetadata.
6 7 8 9 |
# File 'app/models/spotlight/field_metadata.rb', line 6 def initialize(repository, blacklight_config) @repository = repository @blacklight_config = blacklight_config end |
Instance Attribute Details
#blacklight_config ⇒ Object (readonly)
Returns the value of attribute blacklight_config.
5 6 7 |
# File 'app/models/spotlight/field_metadata.rb', line 5 def blacklight_config @blacklight_config end |
#repository ⇒ Object (readonly)
Returns the value of attribute repository.
5 6 7 |
# File 'app/models/spotlight/field_metadata.rb', line 5 def repository @repository end |
Instance Method Details
#field(field_name) ⇒ Object
11 12 13 14 15 16 17 |
# File 'app/models/spotlight/field_metadata.rb', line 11 def field(field_name) { document_count: document_counts.fetch(field_name, 0), value_count: fields.fetch(field_name, {}).fetch('distinct', 0), terms: fields.fetch(field_name, {}).fetch('topTerms', []) } end |