class Riddle::Configuration::Index

Attributes

blend_chars[RW]
blend_mode[RW]
charset_dictpath[RW]
charset_table[RW]
charset_type[RW]
dict[RW]
docinfo[RW]
enable_star[RW]
exception_files[RW]
expand_keywords[RW]
hitless_words[RW]
html_index_attrs[RW]
html_remove_element_tags[RW]
html_strip[RW]
ignore_characters[RW]
index_exact_words[RW]
index_sp[RW]
index_zones[RW]
infix_field_names[RW]
inplace_docinfo_gap[RW]
inplace_enable[RW]
inplace_hit_gap[RW]
inplace_reloc_factor[RW]
inplace_write_factor[RW]
min_infix_len[RW]
min_prefix_len[RW]
min_stemming_len[RW]
min_word_len[RW]
mlock[RW]
morphologies[RW]
name[RW]
ngram_characters[RW]
ngram_len[RW]
ondisk_dict[RW]
overshort_step[RW]
parent[RW]
path[RW]
phrase_boundaries[RW]
phrase_boundary_step[RW]
prefix_field_names[RW]
preopen[RW]
sources[RW]
stopword_files[RW]
stopwords_step[RW]
type[RW]
wordform_files[RW]

Public Class Methods

new(name, *sources) click to toggle source
# File lib/riddle/configuration/index.rb, line 33
def initialize(name, *sources)
  @name                     = name
  @sources                  = sources
  @morphologies             = []
  @stopword_files           = []
  @wordform_files           = []
  @exception_files          = []
  @ignore_characters        = []
  @prefix_field_names       = []
  @infix_field_names        = []
  @ngram_characters         = []
  @phrase_boundaries        = []
  @html_remove_element_tags = []
end
settings() click to toggle source
# File lib/riddle/configuration/index.rb, line 4
def self.settings
  [
    :type, :source, :path, :docinfo, :mlock, :morphology,
    :dict, :index_sp, :index_zones, :min_stemming_len, :stopwords,
    :wordforms, :exceptions, :min_word_len, :charset_dictpath,
    :charset_type, :charset_table, :ignore_chars, :min_prefix_len,
    :min_infix_len, :prefix_fields, :infix_fields, :enable_star,
    :expand_keywords, :ngram_len, :ngram_chars, :phrase_boundary,
    :phrase_boundary_step, :blend_chars, :blend_mode, :html_strip,
    :html_index_attrs, :html_remove_elements, :preopen, :ondisk_dict,
    :inplace_enable, :inplace_hit_gap, :inplace_docinfo_gap,
    :inplace_reloc_factor, :inplace_write_factor, :index_exact_words,
    :overshort_step, :stopwords_step, :hitless_words
  ]
end

Public Instance Methods

exceptions() click to toggle source
# File lib/riddle/configuration/index.rb, line 76
def exceptions
  nil_join @exception_files, " "
end
exceptions=(exceptions) click to toggle source
# File lib/riddle/configuration/index.rb, line 80
def exceptions=(exceptions)
  @exception_files = nil_split exceptions, ' '
end
html_remove_elements() click to toggle source
# File lib/riddle/configuration/index.rb, line 132
def html_remove_elements
  nil_join @html_remove_element_tags, ", "
end
html_remove_elements=(html_remove_elements) click to toggle source
# File lib/riddle/configuration/index.rb, line 136
def html_remove_elements=(html_remove_elements)
  @html_remove_element_tags = nil_split html_remove_elements, %r,\s?/
end
ignore_chars() click to toggle source
# File lib/riddle/configuration/index.rb, line 84
def ignore_chars
  nil_join @ignore_characters, ", "
end
ignore_chars=(ignore_chars) click to toggle source
# File lib/riddle/configuration/index.rb, line 88
def ignore_chars=(ignore_chars)
  @ignore_characters = nil_split ignore_chars, %r,\s?/
end
infix_fields() click to toggle source
# File lib/riddle/configuration/index.rb, line 104
def infix_fields
  nil_join @infix_field_names, ", "
end
infix_fields=(fields) click to toggle source
# File lib/riddle/configuration/index.rb, line 108
def infix_fields=(fields)
  if fields.is_a?(Array)
    @infix_field_names = fields
  else
    @infix_field_names = fields.split(%r,\s*/)
  end
end
morphology() click to toggle source
# File lib/riddle/configuration/index.rb, line 52
def morphology
  nil_join @morphologies, ", "
end
morphology=(morphology) click to toggle source
# File lib/riddle/configuration/index.rb, line 56
def morphology=(morphology)
  @morphologies = nil_split morphology, %r,\s?/
end
ngram_chars() click to toggle source
# File lib/riddle/configuration/index.rb, line 116
def ngram_chars
  nil_join @ngram_characters, ", "
end
ngram_chars=(ngram_chars) click to toggle source
# File lib/riddle/configuration/index.rb, line 120
def ngram_chars=(ngram_chars)
  @ngram_characters = nil_split ngram_chars, %r,\s?/
end
phrase_boundary() click to toggle source
# File lib/riddle/configuration/index.rb, line 124
def phrase_boundary
  nil_join @phrase_boundaries, ", "
end
phrase_boundary=(phrase_boundary) click to toggle source
# File lib/riddle/configuration/index.rb, line 128
def phrase_boundary=(phrase_boundary)
  @phrase_boundaries = nil_split phrase_boundary, %r,\s?/
end
prefix_fields() click to toggle source
# File lib/riddle/configuration/index.rb, line 92
def prefix_fields
  nil_join @prefix_field_names, ", "
end
prefix_fields=(fields) click to toggle source
# File lib/riddle/configuration/index.rb, line 96
def prefix_fields=(fields)
  if fields.is_a?(Array)
    @prefix_field_names = fields
  else
    @prefix_field_names = fields.split(%r,\s*/)
  end
end
render() click to toggle source
# File lib/riddle/configuration/index.rb, line 140
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
source() click to toggle source
# File lib/riddle/configuration/index.rb, line 48
def source
  @sources.collect { |s| s.name }
end
stopwords() click to toggle source
# File lib/riddle/configuration/index.rb, line 60
def stopwords
  nil_join @stopword_files, " "
end
stopwords=(stopwords) click to toggle source
# File lib/riddle/configuration/index.rb, line 64
def stopwords=(stopwords)
  @stopword_files = nil_split stopwords, ' '
end
valid?() click to toggle source
# File lib/riddle/configuration/index.rb, line 153
def valid?
  (!@name.nil?) && (!( @sources.length == 0 || @path.nil? ) || !@parent.nil?)
end
wordforms() click to toggle source
# File lib/riddle/configuration/index.rb, line 68
def wordforms
  nil_join @wordform_files, " "
end
wordforms=(wordforms) click to toggle source
# File lib/riddle/configuration/index.rb, line 72
def wordforms=(wordforms)
  @wordform_files = nil_split wordforms, ' '
end