Skip to content

Commit

Permalink
Another Riddle update - this matches the 1.1.0 release, including all…
Browse files Browse the repository at this point in the history
… Sphinx 1.10-beta settings (though they're not all usable in TS yet).
  • Loading branch information
pat committed Aug 28, 2010
1 parent c67efbe commit a6a5e49
Show file tree
Hide file tree
Showing 8 changed files with 92 additions and 36 deletions.
5 changes: 4 additions & 1 deletion vendor/riddle/lib/riddle/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
module Riddle
class VersionError < StandardError; end
class ResponseError < StandardError; end
class OutOfBoundsError < StandardError; end

# This class was heavily based on the existing Client API by Dmytro Shteflyuk
# and Alexy Kovyrin. Their code worked fine, I just wanted something a bit
Expand Down Expand Up @@ -600,7 +601,9 @@ def request(command, messages)
puts response[4, length]
response[4 + length, response.length - 4 - length]
when Statuses[:error], Statuses[:retry]
raise ResponseError, "searchd error (status: #{status}): #{response[4, response.length - 4]}"
message = response[4, response.length - 4]
klass = message[/out of bounds/] ? OutOfBoundsError : ResponseError
raise klass, "searchd error (status: #{status}): #{message}"
else
raise ResponseError, "Unknown searchd error (status: #{status})"
end
Expand Down
1 change: 1 addition & 0 deletions vendor/riddle/lib/riddle/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
require 'riddle/configuration/distributed_index'
require 'riddle/configuration/index'
require 'riddle/configuration/indexer'
require 'riddle/configuration/realtime_index'
require 'riddle/configuration/remote_index'
require 'riddle/configuration/searchd'
require 'riddle/configuration/source'
Expand Down
29 changes: 15 additions & 14 deletions vendor/riddle/lib/riddle/configuration/index.rb
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
module Riddle
class Configuration
class Index < Riddle::Configuration::Section
self.settings = [:source, :path, :docinfo, :mlock, :morphology,
self.settings = [:type, :source, :path, :docinfo, :mlock, :morphology,
: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, :ngram_len, :ngram_chars, :phrase_boundary,
:phrase_boundary_step, :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]
:enable_star, :expand_keywords, :ngram_len, :ngram_chars,
:phrase_boundary, :phrase_boundary_step, :blend_chars, :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]

attr_accessor :name, :parent, :sources, :path, :docinfo, :mlock,
attr_accessor :name, :parent, :type, :sources, :path, :docinfo, :mlock,
:morphologies, :min_stemming_len, :stopword_files, :wordform_files,
:exception_files, :min_word_len, :charset_dictpath, :charset_type,
:charset_table, :ignore_characters, :min_prefix_len, :min_infix_len,
:prefix_field_names, :infix_field_names, :enable_star, :ngram_len,
:ngram_characters, :phrase_boundaries, :phrase_boundary_step,
:html_strip, :html_index_attrs, :html_remove_element_tags, :preopen,
:ondisk_dict, :inplace_enable, :inplace_hit_gap, :inplace_docinfo_gap,
:inplace_reloc_factor, :inplace_write_factor, :index_exact_words,
:overshort_step, :stopwords_step
:prefix_field_names, :infix_field_names, :enable_star, :expand_keywords,
:ngram_len, :ngram_characters, :phrase_boundaries,
:phrase_boundary_step, :blend_chars, :html_strip, :html_index_attrs,
:html_remove_element_tags, :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

def initialize(name, *sources)
@name = name
Expand Down
2 changes: 1 addition & 1 deletion vendor/riddle/lib/riddle/configuration/indexer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module Riddle
class Configuration
class Indexer < Riddle::Configuration::Section
self.settings = [:mem_limit, :max_iops, :max_iosize, :max_xmlpipe2_field,
:write_buffer]
:write_buffer, :max_file_field_buffer]

attr_accessor *self.settings

Expand Down
39 changes: 39 additions & 0 deletions vendor/riddle/lib/riddle/configuration/realtime_index.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
module Riddle
class Configuration
class RealtimeIndex < Riddle::Configuration::Section
self.settings = [:type, :path, :rt_mem_limit, :rt_field, :rt_attr_uint,
:rt_attr_bigint, :rt_attr_float, :rt_attr_timestamp, :rt_attr_string]

attr_accessor :name
attr_accessor *self.settings

def initialize(name)
@name = name
@rt_field = []
@rt_attr_uint = []
@rt_attr_bigint = []
@rt_attr_float = []
@rt_attr_timestamp = []
@rt_attr_string = []
end

def type
"rt"
end

def valid?
!(@name.nil? || @path.nil?)
end

def render
raise ConfigurationError unless valid?

(
["index #{name}", "{"] +
settings_body +
["}", ""]
).join("\n")
end
end
end
end
4 changes: 3 additions & 1 deletion vendor/riddle/lib/riddle/configuration/searchd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ class Searchd < Riddle::Configuration::Section
:seamless_rotate, :preopen_indexes, :unlink_old, :attr_flush_period,
:ondisk_dict_default, :max_packet_size, :mva_updates_pool,
:crash_log_path, :max_filters, :max_filter_values, :listen_backlog,
:read_buffer, :read_unhinted]
:read_buffer, :read_unhinted, :max_batch_queries, :subtree_docs_cache,
:subtree_hits_cache, :workers, :dist_threads, :binlog_path,
:binlog_flush, :binlog_max_log_size]

attr_accessor *self.settings

Expand Down
44 changes: 26 additions & 18 deletions vendor/riddle/lib/riddle/configuration/sql_source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,39 @@ class SQLSource < Riddle::Configuration::Source
self.settings = [:type, :sql_host, :sql_user, :sql_pass, :sql_db,
:sql_port, :sql_sock, :mysql_connect_flags, :mysql_ssl_cert,
:mysql_ssl_key, :mysql_ssl_ca, :odbc_dsn, :sql_query_pre, :sql_query,
:sql_query_range, :sql_range_step, :sql_query_killlist, :sql_attr_uint,
:sql_attr_bool, :sql_attr_bigint, :sql_attr_timestamp,
:sql_attr_str2ordinal, :sql_attr_float, :sql_attr_multi,
:sql_query_post, :sql_query_post_index, :sql_ranged_throttle,
:sql_query_info, :mssql_winauth, :mssql_unicode, :unpack_zlib,
:unpack_mysqlcompress, :unpack_mysqlcompress_maxsize]
:sql_joined_field, :sql_file_field, :sql_query_range, :sql_range_step,
:sql_query_killlist, :sql_attr_uint, :sql_attr_bool, :sql_attr_bigint,
:sql_attr_timestamp, :sql_attr_str2ordinal, :sql_attr_float,
:sql_attr_multi, :sql_attr_string, :sql_attr_str2wordcount,
:sql_field_string, :sql_field_str2wordcount, :sql_query_post,
:sql_query_post_index, :sql_ranged_throttle, :sql_query_info,
:mssql_winauth, :mssql_unicode, :unpack_zlib, :unpack_mysqlcompress,
:unpack_mysqlcompress_maxsize]

attr_accessor *self.settings

def initialize(name, type)
@name = name
@type = type

@sql_query_pre = []
@sql_attr_uint = []
@sql_attr_bool = []
@sql_attr_bigint = []
@sql_attr_timestamp = []
@sql_attr_str2ordinal = []
@sql_attr_float = []
@sql_attr_multi = []
@sql_query_post = []
@sql_query_post_index = []
@unpack_zlib = []
@unpack_mysqlcompress = []
@sql_query_pre = []
@sql_joined_field = []
@sql_file_field = []
@sql_attr_uint = []
@sql_attr_bool = []
@sql_attr_bigint = []
@sql_attr_timestamp = []
@sql_attr_str2ordinal = []
@sql_attr_float = []
@sql_attr_multi = []
@sql_attr_string = []
@sql_attr_str2wordcount = []
@sql_field_string = []
@sql_field_str2wordcount = []
@sql_query_post = []
@sql_query_post_index = []
@unpack_zlib = []
@unpack_mysqlcompress = []
end

def valid?
Expand Down
4 changes: 3 additions & 1 deletion vendor/riddle/lib/riddle/controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,12 @@ def start
end

def stop
return unless running?
return true unless running?
Process.kill('SIGTERM', pid.to_i)
rescue Errno::EINVAL
Process.kill('SIGKILL', pid.to_i)
ensure
return !running?
end

def pid
Expand Down

0 comments on commit a6a5e49

Please sign in to comment.