Class: Krikri::SearchIndex
- Inherits:
-
Object
- Object
- Krikri::SearchIndex
- Defined in:
- lib/krikri/search_index.rb
Overview
Search index base class that gets extended by QA and Production index classes
Direct Known Subclasses
Instance Method Summary collapse
-
#add(_) ⇒ Object
Add a single JSON document to the search index.
-
#bulk_add(_) ⇒ Object
Add a number of JSON documents to the search index at once.
-
#initialize(opts) ⇒ SearchIndex
constructor
A new instance of SearchIndex.
-
#update_from_activity(activity) ⇒ Object
Shim that determines, for a particular type of index, which strategy to use, adding a single document, or adding them in bulk.
Constructor Details
#initialize(opts) ⇒ SearchIndex
Returns a new instance of SearchIndex.
10 11 12 |
# File 'lib/krikri/search_index.rb', line 10 def initialize(opts) @bulk_update_size = opts.delete(:bulk_update_size) { 10 } end |
Instance Method Details
#add(_) ⇒ Object
Add a single JSON document to the search index. Implemented in a child class.
19 20 21 |
# File 'lib/krikri/search_index.rb', line 19 def add(_) fail NotImplementedError end |
#bulk_add(_) ⇒ Object
Add a number of JSON documents to the search index at once. Implemented in a child class.
28 29 30 |
# File 'lib/krikri/search_index.rb', line 28 def bulk_add(_) fail NotImplementedError end |
#update_from_activity(activity) ⇒ Object
Shim that determines, for a particular type of index, which strategy to use, adding a single document, or adding them in bulk. Intended to be overridden as necessary.
39 40 41 |
# File 'lib/krikri/search_index.rb', line 39 def update_from_activity(activity) incremental_update_from_activity(activity) end |