Module: Litesearch
- Included in:
- Litedb
- Defined in:
- lib/litestack/litesearch.rb,
lib/litestack/litesearch.rb
Defined Under Namespace
Modules: Model
Classes: Index, Schema, SchemaChangeException, SchemaException
Instance Method Summary
collapse
Instance Method Details
#litesearch_index_cache ⇒ Object
11
12
13
|
# File 'lib/litestack/litesearch.rb', line 11
def litesearch_index_cache
@litesearch_index_cache ||= {}
end
|
#search_index(name) ⇒ Object
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/litestack/litesearch.rb', line 15
def search_index(name)
name = name.to_s.downcase.to_sym
index = litesearch_index_cache[name]
return index if index && !block_given?
index = if block_given?
Index.new(self, name) do |schema|
yield schema
schema.name(name)
end
else
Index.new(self, name)
end
litesearch_index_cache[name] = index
end
|