Module: Zena::Use::MLIndex::ModelMethods

Included in:
Node
Defined in:
lib/zena/use/ml_index.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



5
6
7
# File 'lib/zena/use/ml_index.rb', line 5

def self.included(base)
  base.alias_method_chain :rebuild_index!, :multi_lingual
end

Instance Method Details

#index_reader(group_name) ⇒ Object

Hash used to read current values



34
35
36
37
38
39
40
41
# File 'lib/zena/use/ml_index.rb', line 34

def index_reader(group_name)
  if group_name =~ /^ml_/
    return nil if index_langs.empty?
    super.merge(:with => {'lang' => index_langs})
  else
    super
  end
end

#rebuild_index_for_version(v) ⇒ Object



28
29
30
# File 'lib/zena/use/ml_index.rb', line 28

def rebuild_index_for_version(v)
  # noop (method chaining in PropEval, Fulltext, etc)
end

#rebuild_index_with_multi_lingual!Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/zena/use/ml_index.rb', line 9

def rebuild_index_with_multi_lingual!
  visible_versions.each do |version|
    # 1. for each visible version
    self.version = version
    @properties  = version.prop
    # rebuild for each lang
    @index_langs = nil
    # Forces a to skip multi lingual indices
    # @index_langs = []

    # Build std index
    rebuild_index_for_version(version)
    rebuild_index_without_multi_lingual!
    # 2. PropEval::rebuild_index!
    # 3. Fulltext::rebuild_index!
    # 4. Properties::rebuild_index!
  end
end