Module: Esse::Index::ObjectDocumentMapper
- Included in:
- Esse::Index
- Defined in:
- lib/esse/index/object_document_mapper.rb
Instance Method Summary collapse
-
#documents(repo_name = nil, **kwargs) ⇒ Enumerator
Wrap collection data into serialized documents.
-
#each_serialized_batch(repo_name = nil, **kwargs) {|Array, **context| ... } ⇒ Enumerator
Wrap collection data into serialized batches.
Instance Method Details
#documents(repo_name = nil, **kwargs) ⇒ Enumerator
Wrap collection data into serialized documents
Example:
GeosIndex.documents(id: 1).first
25 26 27 28 29 30 31 |
# File 'lib/esse/index/object_document_mapper.rb', line 25 def documents(repo_name = nil, **kwargs) Enumerator.new do |yielder| each_serialized_batch(repo_name, **kwargs) do |documents, **_collection_kargs| documents.each { |document| yielder.yield(document) } end end end |
#each_serialized_batch(repo_name = nil, **kwargs) {|Array, **context| ... } ⇒ Enumerator
Wrap collection data into serialized batches
12 13 14 15 16 |
# File 'lib/esse/index/object_document_mapper.rb', line 12 def each_serialized_batch(repo_name = nil, **kwargs, &block) (repo_name ? [repo(repo_name)] : repo_hash.values).each do |repo| repo.each_serialized_batch(**kwargs, &block) end end |