Module: Redis::TextSearch
- Defined in:
- lib/redis/text_search.rb,
lib/redis/text_search/collection.rb
Overview
Redis::TextSearch enables high-performance text search in your app using Redis. You can perform text search on any type of data store or ORM.
Defined Under Namespace
Modules: ClassMethods, InstanceMethods, WpHelpers
Classes: BadConditions, BadTextIndex, Collection, InvalidPage, NoFinderMethod
Constant Summary
collapse
- DEFAULT_EXCLUDE_LIST =
%w(a an and as at but by for in into of on onto to the)
Class Method Summary
collapse
Class Method Details
.included(klass) ⇒ Object
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/redis/text_search.rb', line 23
def included(klass)
klass.instance_variable_set('@redis', @redis)
klass.instance_variable_set('@text_indexes', {})
klass.instance_variable_set('@text_search_find', nil)
klass.instance_variable_set('@text_index_exclude_list', DEFAULT_EXCLUDE_LIST)
klass.send :include, InstanceMethods
klass.extend ClassMethods
klass.extend WpHelpers unless respond_to?(:wp_count)
class << klass
define_method(:per_page) { 30 } unless respond_to?(:per_page)
end
end
|
.redis ⇒ Object
19
20
21
|
# File 'lib/redis/text_search.rb', line 19
def redis
@redis ||= $redis || raise(NotConnected, "Redis::TextSearch.redis not set to a Redis.new connection")
end
|
.redis=(conn) ⇒ Object
18
|
# File 'lib/redis/text_search.rb', line 18
def redis=(conn) @redis = conn end
|