Class: Spinel::Client

Inherits:
Object
  • Object
show all
Includes:
Helper, Indexer, Searcher
Defined in:
lib/spinel/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Searcher

#cache_enable, #search, #search_option, #search_word_split, #set_cache

Methods included from Indexer

#get, #remove, #store

Methods included from Helper

#document_id, #document_index_fields, #document_score, #get_valid_document, #prefixes, #squish

Constructor Details

#initialize(type = :default) ⇒ Client

Returns a new instance of Client.



9
10
11
# File 'lib/spinel/client.rb', line 9

def initialize type = :default
  @type = type
end

Instance Attribute Details

#typeObject

Returns the value of attribute type.



7
8
9
# File 'lib/spinel/client.rb', line 7

def type
  @type
end

Instance Method Details

#cachekey(words) ⇒ Object



21
22
23
# File 'lib/spinel/client.rb', line 21

def cachekey words
  "#{Spinel.namespace}:cache:#{type}:#{words.join('|')}"
end

#databaseObject



17
18
19
# File 'lib/spinel/client.rb', line 17

def database
  "#{Spinel.namespace}:data:#{type}"
end

#index(p) ⇒ Object



13
14
15
# File 'lib/spinel/client.rb', line 13

def index p
  "#{Spinel.namespace}:index:#{type}:#{p}"
end