Module: ActiveSearch::Mongoid
- Defined in:
- lib/activesearch/mongoid.rb,
lib/activesearch/mongoid/index.rb,
lib/activesearch/mongoid/full_text_search_query.rb
Defined Under Namespace
Classes: FullTextSearchQuery, Index
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.included(base) ⇒ Object
18
19
20
21
22
|
# File 'lib/activesearch/mongoid.rb', line 18
def self.included(base)
base.class_eval do
include Base
end
end
|
Instance Method Details
#to_indexable(depth = 0) ⇒ Object
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/activesearch/mongoid.rb', line 24
def to_indexable(depth = 0)
{}.tap do |doc|
_locale = search_locale
search_fields.each do |field|
if content = send(field)
doc[field.to_s] = if content.is_a?(Hash) && content.has_key?(_locale)
ActiveSearch.strip_tags(content[_locale])
elsif content && content.respond_to?(:to_indexable)
ActiveSearch.strip_tags(content.to_indexable(depth + 1))
else
ActiveSearch.strip_tags(content)
end
end
end
end
end
|