Class: Riddle::Configuration::Index

Inherits:
Section
  • Object
show all
Includes:
IndexSettings
Defined in:
lib/riddle/configuration/index.rb

Instance Attribute Summary collapse

Attributes included from IndexSettings

#bigram_freq_words, #bigram_index, #blend_chars, #blend_mode, #charset_dictpath, #charset_table, #charset_type, #dict, #docinfo, #enable_star, #exception_files, #expand_keywords, #global_idf, #ha_strategy, #hitless_words, #html_index_attrs, #html_remove_element_tags, #html_strip, #ignore_characters, #index_exact_words, #index_field_lengths, #index_sp, #index_zones, #infix_field_names, #inplace_docinfo_gap, #inplace_enable, #inplace_hit_gap, #inplace_reloc_factor, #inplace_write_factor, #min_infix_len, #min_prefix_len, #min_stemming_len, #min_word_len, #mlock, #morphologies, #name, #ngram_characters, #ngram_len, #ondisk_attrs, #ondisk_dict, #overshort_step, #path, #phrase_boundaries, #phrase_boundary_step, #prefix_field_names, #preopen, #regexp_filter, #rlp_context, #stopword_files, #stopwords_step, #stopwords_unstemmed, #type, #wordform_files

Class Method Summary collapse

Instance Method Summary collapse

Methods included from IndexSettings

#exceptions, #exceptions=, #html_remove_elements, #html_remove_elements=, #ignore_chars, #ignore_chars=, #infix_fields, #infix_fields=, #initialize_settings, #morphology, #morphology=, #ngram_chars, #ngram_chars=, #phrase_boundary, #phrase_boundary=, #prefix_fields, #prefix_fields=, #stopwords, #stopwords=, #wordforms, #wordforms=

Constructor Details

#initialize(name, *sources) ⇒ Index

Returns a new instance of Index


12
13
14
15
16
17
# File 'lib/riddle/configuration/index.rb', line 12

def initialize(name, *sources)
  @name                     = name
  @sources                  = sources

  initialize_settings
end

Instance Attribute Details

#parentObject

Returns the value of attribute parent


10
11
12
# File 'lib/riddle/configuration/index.rb', line 10

def parent
  @parent
end

#sourcesObject

Returns the value of attribute sources


10
11
12
# File 'lib/riddle/configuration/index.rb', line 10

def sources
  @sources
end

Class Method Details

.settingsObject


6
7
8
# File 'lib/riddle/configuration/index.rb', line 6

def self.settings
  Riddle::Configuration::IndexSettings.settings + [:source]
end

Instance Method Details

#renderObject

Raises:


23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/riddle/configuration/index.rb', line 23

def render
  raise ConfigurationError, "#{@name} #{@sources.inspect} #{@path} #{@parent}" unless valid?

  inherited_name = "#{name}"
  inherited_name << " : #{parent}" if parent
  (
    @sources.collect { |s| s.render } +
    ["index #{inherited_name}", "{"] +
    settings_body +
    ["}", ""]
  ).join("\n")
end

#sourceObject


19
20
21
# File 'lib/riddle/configuration/index.rb', line 19

def source
  @sources.collect { |s| s.name }
end

#valid?Boolean

Returns:

  • (Boolean)

36
37
38
# File 'lib/riddle/configuration/index.rb', line 36

def valid?
  (!@name.nil?) && (!( @sources.length == 0 || @path.nil? ) || !@parent.nil?)
end