Class: SolrResults
- Inherits:
-
Object
- Object
- SolrResults
- Includes:
- RecordHelper
- Defined in:
- public/app/models/solr_results.rb
Instance Attribute Summary collapse
-
#facets ⇒ Object
readonly
Returns the value of attribute facets.
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
-
#records ⇒ Object
readonly
Returns the value of attribute records.
Instance Method Summary collapse
-
#[](k) ⇒ Object
while this is available it cannot be private Ruby 2.5+.
-
#empty? ⇒ Boolean
-
#first ⇒ Object
-
#initialize(solr_results, search_opts = {}, full = false) ⇒ SolrResults
constructor
A new instance of SolrResults.
Methods included from RecordHelper
#badge_for_type, #icon_for_type, #record_class_for_type, #record_for_type, #record_from_resolved_json
Constructor Details
#initialize(solr_results, search_opts = {}, full = false) ⇒ SolrResults
Returns a new instance of SolrResults.
6 7 8 9 10 |
# File 'public/app/models/solr_results.rb', line 6 def initialize(solr_results, search_opts = {}, full = false) @raw = solr_results @records = parse_records(full) @search_opts = search_opts end |
Instance Attribute Details
#facets ⇒ Object (readonly)
Returns the value of attribute facets
4 5 6 |
# File 'public/app/models/solr_results.rb', line 4 def facets @facets end |
#raw ⇒ Object (readonly)
Returns the value of attribute raw
4 5 6 |
# File 'public/app/models/solr_results.rb', line 4 def raw @raw end |
#records ⇒ Object (readonly)
Returns the value of attribute records
4 5 6 |
# File 'public/app/models/solr_results.rb', line 4 def records @records end |
Instance Method Details
#[](k) ⇒ Object
while this is available it cannot be private Ruby 2.5+
21 22 23 24 |
# File 'public/app/models/solr_results.rb', line 21 def [](k) # $stderr.puts "FIXME stop direct access to the results json blob ([]): #{caller.first}" raw[k] end |
#empty? ⇒ Boolean
12 13 14 |
# File 'public/app/models/solr_results.rb', line 12 def empty? @raw['results'].blank? || @raw['results'].empty? end |
#first ⇒ Object
16 17 18 |
# File 'public/app/models/solr_results.rb', line 16 def first @records.first end |