| Class | ActsAsSolr::SearchResults |
| In: |
lib/search_results.rb
|
| Parent: | Object |
TODO: Possibly looking into hooking it up with Solr::Response::Standard
Class that returns the search results with four methods.
books = Book.find_by_solr 'ruby'
the above will return a SearchResults class with 4 methods:
docs|results|records: will return an array of records found
books.records.empty? => false
total|num_found|total_hits: will return the total number of records found
books.total => 2
facets: will return the facets when doing a faceted search
max_score|highest_score: returns the highest score found
books.max_score => 1.3213213
Returns the highest score found. This method is also aliased as highest_score
# File lib/search_results.rb, line 53 def max_score @solr_data[:max_score] end
Returns the total records found. This method is also aliased as num_found and total_hits
# File lib/search_results.rb, line 42 def total @solr_data[:total] end