Class: CloudSearch::Indexer
- Inherits:
-
Object
- Object
- CloudSearch::Indexer
- Includes:
- ConfigurationChecking
- Defined in:
- lib/eden_cloud_search/indexer.rb
Instance Method Summary collapse
- #<<(document) ⇒ Object (also: #add)
- #documents ⇒ Object
- #index ⇒ Object
-
#initialize ⇒ Indexer
constructor
A new instance of Indexer.
Constructor Details
#initialize ⇒ Indexer
Returns a new instance of Indexer.
5 6 7 |
# File 'lib/eden_cloud_search/indexer.rb', line 5 def initialize @documents = [] end |
Instance Method Details
#<<(document) ⇒ Object Also known as: add
9 10 11 12 |
# File 'lib/eden_cloud_search/indexer.rb', line 9 def <<(document) raise InvalidDocument.new(document) unless document.valid? @documents << document end |
#documents ⇒ Object
16 17 18 |
# File 'lib/eden_cloud_search/indexer.rb', line 16 def documents @documents.freeze end |
#index ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/eden_cloud_search/indexer.rb', line 20 def index cloud_search_response = RestClient.post url, documents_json, headers = "#{cloud_search_response.code} - #{cloud_search_response.length} bytes\n#{url}\n" response = JSON.parse cloud_search_response.body [response, ] end |