Class: Krikri::SearchIndex
- Inherits:
-
Object
- Object
- Krikri::SearchIndex
- Defined in:
- lib/krikri/search_index.rb
Overview
rewrite to use generalized ‘EntityConsumer` interface & avoid `#update_from_activity`, which is tighly bound to `Activity` rather than `Enumerator<#entities>`.
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.
14 15 16 |
# File 'lib/krikri/search_index.rb', line 14 def initialize(opts) @bulk_update_size = opts.delete(:bulk_update_size) { 1000 } end |
Instance Method Details
#add(_) ⇒ Object
Add a single JSON document to the search index. Implemented in a child class.
23 24 25 |
# File 'lib/krikri/search_index.rb', line 23 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.
32 33 34 |
# File 'lib/krikri/search_index.rb', line 32 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.
43 44 45 |
# File 'lib/krikri/search_index.rb', line 43 def update_from_activity(activity) incremental_update_from_activity(activity) end |