Class: Skala::ElasticsearchAdapter

Inherits:
Adapter
  • Object
show all
Defined in:
lib/skala/elasticsearch_adapter.rb

Defined Under Namespace

Classes: Search

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Adapter

#authenticate_user, #create_user_hold_request, #delete_user_hold_request, #get_record_holdable_items, #get_record_items, #get_records, #get_user, #get_user_cash, #get_user_former_loans, #get_user_hold_requests, #get_user_inter_library_loans, #get_user_loans, #get_user_transactions, #renew_user_loan, #renew_user_loans, #search, #update_user

Constructor Details

#initialize(options = {}) ⇒ ElasticsearchAdapter

Returns a new instance of ElasticsearchAdapter.



18
19
20
21
22
23
24
25
# File 'lib/skala/elasticsearch_adapter.rb', line 18

def initialize(options = {})
  HashWithIndifferentAccess.new(options).try do |_options|
    self.hosts   = _options[:hosts] || _options[:host] || _options[:urls] || _options[:url]
    self.index   = _options[:index]
    self.timeout = _options[:timeout]
    self.type    = _options[:type]
  end
end

Instance Attribute Details

#hostsObject

Returns the value of attribute hosts.



9
10
11
# File 'lib/skala/elasticsearch_adapter.rb', line 9

def hosts
  @hosts
end

#indexObject

Returns the value of attribute index.



10
11
12
# File 'lib/skala/elasticsearch_adapter.rb', line 10

def index
  @index
end

#timeoutObject

Returns the value of attribute timeout.



11
12
13
# File 'lib/skala/elasticsearch_adapter.rb', line 11

def timeout
  @timeout
end

#typeObject

Returns the value of attribute type.



12
13
14
# File 'lib/skala/elasticsearch_adapter.rb', line 12

def type
  @type
end

Instance Method Details

#elasticsearch_clientObject

internal api between adapter and operations



30
31
32
# File 'lib/skala/elasticsearch_adapter.rb', line 30

def elasticsearch_client
  Elasticsearch::Client.new hosts: @hosts
end