thinking-sphinx 1.3.2 → 1.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. data/VERSION.yml +1 -1
  2. data/features/support/env.rb +2 -1
  3. data/lib/thinking_sphinx.rb +0 -1
  4. data/lib/thinking_sphinx/0.9.8.rb +3 -0
  5. data/lib/thinking_sphinx/0.9.9.rb +3 -0
  6. data/rails/init.rb +1 -1
  7. data/tasks/distribution.rb +3 -4
  8. metadata +24 -26
  9. data/vendor/after_commit/LICENSE +0 -20
  10. data/vendor/after_commit/README +0 -16
  11. data/vendor/after_commit/Rakefile +0 -22
  12. data/vendor/after_commit/init.rb +0 -8
  13. data/vendor/after_commit/lib/after_commit.rb +0 -45
  14. data/vendor/after_commit/lib/after_commit/active_record.rb +0 -114
  15. data/vendor/after_commit/lib/after_commit/connection_adapters.rb +0 -103
  16. data/vendor/after_commit/test/after_commit_test.rb +0 -53
  17. data/vendor/riddle/lib/riddle.rb +0 -30
  18. data/vendor/riddle/lib/riddle/client.rb +0 -635
  19. data/vendor/riddle/lib/riddle/client/filter.rb +0 -53
  20. data/vendor/riddle/lib/riddle/client/message.rb +0 -66
  21. data/vendor/riddle/lib/riddle/client/response.rb +0 -84
  22. data/vendor/riddle/lib/riddle/configuration.rb +0 -33
  23. data/vendor/riddle/lib/riddle/configuration/distributed_index.rb +0 -48
  24. data/vendor/riddle/lib/riddle/configuration/index.rb +0 -142
  25. data/vendor/riddle/lib/riddle/configuration/indexer.rb +0 -19
  26. data/vendor/riddle/lib/riddle/configuration/remote_index.rb +0 -17
  27. data/vendor/riddle/lib/riddle/configuration/searchd.rb +0 -25
  28. data/vendor/riddle/lib/riddle/configuration/section.rb +0 -43
  29. data/vendor/riddle/lib/riddle/configuration/source.rb +0 -23
  30. data/vendor/riddle/lib/riddle/configuration/sql_source.rb +0 -34
  31. data/vendor/riddle/lib/riddle/configuration/xml_source.rb +0 -28
  32. data/vendor/riddle/lib/riddle/controller.rb +0 -55
@@ -1,17 +0,0 @@
1
- module Riddle
2
- class Configuration
3
- class RemoteIndex
4
- attr_accessor :address, :port, :name
5
-
6
- def initialize(address, port, name)
7
- @address = address
8
- @port = port
9
- @name = name
10
- end
11
-
12
- def remote
13
- "#{address}:#{port}"
14
- end
15
- end
16
- end
17
- end
@@ -1,25 +0,0 @@
1
- module Riddle
2
- class Configuration
3
- class Searchd < Riddle::Configuration::Section
4
- self.settings = [:address, :port, :log, :query_log, :read_timeout,
5
- :max_children, :pid_file, :max_matches, :seamless_rotate,
6
- :preopen_indexes, :unlink_old]
7
-
8
- attr_accessor *self.settings
9
-
10
- def render
11
- raise ConfigurationError unless valid?
12
-
13
- (
14
- ["searchd", "{"] +
15
- settings_body +
16
- ["}", ""]
17
- ).join("\n")
18
- end
19
-
20
- def valid?
21
- !( @port.nil? || @pid_file.nil? )
22
- end
23
- end
24
- end
25
- end
@@ -1,43 +0,0 @@
1
- module Riddle
2
- class Configuration
3
- class Section
4
- class << self
5
- attr_accessor :settings
6
- end
7
-
8
- settings = []
9
-
10
- def valid?
11
- true
12
- end
13
-
14
- private
15
-
16
- def settings_body
17
- self.class.settings.select { |setting|
18
- !send(setting).nil?
19
- }.collect { |setting|
20
- if send(setting) == ""
21
- conf = " #{setting} = "
22
- else
23
- conf = setting_to_array(setting).collect { |set|
24
- " #{setting} = #{set}"
25
- }
26
- end
27
- conf.length == 0 ? nil : conf
28
- }.flatten.compact
29
- end
30
-
31
- def setting_to_array(setting)
32
- value = send(setting)
33
- case value
34
- when Array then value
35
- when TrueClass then [1]
36
- when FalseClass then [0]
37
- else
38
- [value]
39
- end
40
- end
41
- end
42
- end
43
- end
@@ -1,23 +0,0 @@
1
- module Riddle
2
- class Configuration
3
- class Source < Riddle::Configuration::Section
4
- attr_accessor :name, :parent, :type
5
-
6
- def render
7
- raise ConfigurationError unless valid?
8
-
9
- inherited_name = "#{name}"
10
- inherited_name << " : #{parent}" if parent
11
- (
12
- ["source #{inherited_name}", "{"] +
13
- settings_body +
14
- ["}", ""]
15
- ).join("\n")
16
- end
17
-
18
- def valid?
19
- !( @name.nil? || @type.nil? )
20
- end
21
- end
22
- end
23
- end
@@ -1,34 +0,0 @@
1
- module Riddle
2
- class Configuration
3
- class SQLSource < Riddle::Configuration::Source
4
- self.settings = [:type, :sql_host, :sql_user, :sql_pass, :sql_db,
5
- :sql_port, :sql_sock, :mysql_connect_flags, :sql_query_pre, :sql_query,
6
- :sql_query_range, :sql_range_step, :sql_attr_uint, :sql_attr_bool,
7
- :sql_attr_timestamp, :sql_attr_str2ordinal, :sql_attr_float,
8
- :sql_attr_multi, :sql_query_post, :sql_query_post_index,
9
- :sql_ranged_throttle, :sql_query_info]
10
-
11
- attr_accessor *self.settings
12
-
13
- def initialize(name, type)
14
- @name = name
15
- @type = type
16
-
17
- @sql_query_pre = []
18
- @sql_attr_uint = []
19
- @sql_attr_bool = []
20
- @sql_attr_timestamp = []
21
- @sql_attr_str2ordinal = []
22
- @sql_attr_float = []
23
- @sql_attr_multi = []
24
- @sql_query_post = []
25
- @sql_query_post_index = []
26
- end
27
-
28
- def valid?
29
- super && (!( @sql_host.nil? || @sql_user.nil? || @sql_db.nil? ||
30
- @sql_query.nil? ) || !@parent.nil?)
31
- end
32
- end
33
- end
34
- end
@@ -1,28 +0,0 @@
1
- module Riddle
2
- class Configuration
3
- class XMLSource < Riddle::Configuration::Source
4
- self.settings = [:type, :xmlpipe_command, :xmlpipe_field,
5
- :xmlpipe_attr_uint, :xmlpipe_attr_bool, :xmlpipe_attr_timestamp,
6
- :xmlpipe_attr_str2ordinal, :xmlpipe_attr_float, :xmlpipe_attr_multi]
7
-
8
- attr_accessor *self.settings
9
-
10
- def initialize(name, type)
11
- @name = name
12
- @type = type
13
-
14
- @xmlpipe_field = []
15
- @xmlpipe_attr_uint = []
16
- @xmlpipe_attr_bool = []
17
- @xmlpipe_attr_timestamp = []
18
- @xmlpipe_attr_str2ordinal = []
19
- @xmlpipe_attr_float = []
20
- @xmlpipe_attr_multi = []
21
- end
22
-
23
- def valid?
24
- super && ( !@xmlpipe_command.nil? || !parent.nil? )
25
- end
26
- end
27
- end
28
- end
@@ -1,55 +0,0 @@
1
- module Riddle
2
- class Controller
3
- def initialize(configuration, path)
4
- @configuration = configuration
5
- @path = path
6
- end
7
-
8
- def index(*indexes)
9
- indexes << '--all' if indexes.empty?
10
-
11
- cmd = "indexer --config #{@path} #{indexes.join(' ')}"
12
- cmd << " --rotate" if running?
13
- `#{cmd}`
14
- end
15
-
16
- def start
17
- return if running?
18
-
19
- cmd = "searchd --pidfile --config #{@path}"
20
-
21
- if RUBY_PLATFORM =~ /mswin/
22
- system("start /B #{cmd} 1> NUL 2>&1")
23
- else
24
- `#{cmd}`
25
- end
26
-
27
- sleep(1)
28
-
29
- unless running?
30
- puts "Failed to start searchd daemon. Check #{@configuration.searchd.log}."
31
- end
32
- end
33
-
34
- def stop
35
- return unless running?
36
- Process.kill('SIGTERM', pid.to_i)
37
- rescue Errno::EINVAL
38
- Process.kill('SIGKILL', pid.to_i)
39
- end
40
-
41
- def pid
42
- if File.exists?(@configuration.searchd.pid_file)
43
- File.read(@configuration.searchd.pid_file)[/\d+/]
44
- else
45
- nil
46
- end
47
- end
48
-
49
- def running?
50
- !!pid && !!Process.kill(0, pid.to_i)
51
- rescue
52
- false
53
- end
54
- end
55
- end