Class: Appfuel::ElasticSearch::Repository

Inherits:
Repository::Base show all
Defined in:
lib/appfuel/storage/elastic_search/repository.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Repository::Base

#apply_query_conditions, #build, #build_criteria, #build_default_entity, #build_domains, cache, create_mapper, #create_settings, #criteria?, #execute_query_method, #exists?, #find_entity_builder, #generate_uuid, inherited, #mapper, #query, #query_setup, #timestamp, #url_token

Methods included from Application::AppContainer

#app_container, #feature_name, included, #qualify_container_key

Class Method Details

.container_class_typeObject



5
6
7
# File 'lib/appfuel/storage/elastic_search/repository.rb', line 5

def container_class_type
  "#{super}.elastic_search"
end

Instance Method Details

#extract_sources(results) ⇒ Object



22
23
24
# File 'lib/appfuel/storage/elastic_search/repository.rb', line 22

def extract_sources(results)
  results["hits"]["hits"].map { |hit| hit["_source"] }
end

#extract_sources_by_type(results) ⇒ Object



26
27
28
29
30
31
32
33
# File 'lib/appfuel/storage/elastic_search/repository.rb', line 26

def extract_sources_by_type(results)
  documents = {}
  results["hits"]["hits"].each do |hit|
    documents[hit["_type"]] ||= []
    documents[hit["_type"]] << hit["_source"]
  end
  documents
end

#extract_total(results) ⇒ Object



35
36
37
# File 'lib/appfuel/storage/elastic_search/repository.rb', line 35

def extract_total(results)
  results["hits"]["total"]
end

#storage_class(domain_name) ⇒ Object



10
11
12
# File 'lib/appfuel/storage/elastic_search/repository.rb', line 10

def storage_class(domain_name)
  mapper.storage_class('elastic_search', domain_name)
end

#to_entity(domain_name, storage) ⇒ Object



14
15
16
# File 'lib/appfuel/storage/elastic_search/repository.rb', line 14

def to_entity(domain_name, storage)
  super(domain_name, 'elastic_search', storage)
end

#to_storage(domain, opts = {}) ⇒ Object



18
19
20
# File 'lib/appfuel/storage/elastic_search/repository.rb', line 18

def to_storage(domain, opts = {})
  super(domain, 'elastic_search', opts)
end