Class: Krikri::RandomSearchIndexDocumentBuilder
- Inherits:
-
Object
- Object
- Krikri::RandomSearchIndexDocumentBuilder
- Defined in:
- lib/krikri/random_search_index_document_builder.rb
Overview
Gets random records from the search index
Instance Attribute Summary collapse
-
#provider_id ⇒ Object
Returns the value of attribute provider_id.
Instance Method Summary collapse
-
#document ⇒ Object
Krikri::SearchIndexDocument.
-
#initialize(&block) ⇒ RandomSearchIndexDocumentBuilder
constructor
A new instance of RandomSearchIndexDocumentBuilder.
Constructor Details
#initialize(&block) ⇒ RandomSearchIndexDocumentBuilder
Returns a new instance of RandomSearchIndexDocumentBuilder.
12 13 14 15 |
# File 'lib/krikri/random_search_index_document_builder.rb', line 12 def initialize(&block) # set values from block instance_eval &block if block_given? end |
Instance Attribute Details
#provider_id ⇒ Object
Returns the value of attribute provider_id.
4 5 6 |
# File 'lib/krikri/random_search_index_document_builder.rb', line 4 def provider_id @provider_id end |
Instance Method Details
#document ⇒ Object
Returns Krikri::SearchIndexDocument.
18 19 20 21 22 23 |
# File 'lib/krikri/random_search_index_document_builder.rb', line 18 def document solr_response = Krikri::SolrResponseBuilder.new(query_params) return nil if solr_response.response.docs.empty? Krikri::SearchIndexDocument.new(solr_response.response.docs.first) end |