sphinx 0.9.10 → 0.9.10.2043
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -2
- data/Rakefile +1 -1
- data/VERSION.yml +1 -0
- data/lib/sphinx.rb +9 -3
- data/lib/sphinx/buffered_io.rb +22 -0
- data/lib/sphinx/client.rb +661 -259
- data/lib/sphinx/server.rb +167 -0
- data/lib/sphinx/timeout.rb +28 -0
- data/spec/client_response_spec.rb +29 -28
- data/spec/client_spec.rb +650 -471
- data/spec/client_validations_spec.rb +850 -0
- data/spec/spec_helper.rb +24 -0
- data/sphinx.gemspec +11 -7
- metadata +9 -5
- data/install.rb +0 -5
- data/sphinx.yml.tpl +0 -3
- data/tasks/sphinx.rake +0 -75
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../init'
|
2
|
+
|
3
|
+
# Helper exception class to omit real dialogue between client and server
|
4
|
+
class SphinxSpecError < StandardError; end
|
5
|
+
|
6
|
+
# Runs PHP fixture to get request dump
|
7
|
+
def sphinx_fixture(name)
|
8
|
+
`php #{File.dirname(__FILE__)}/fixtures/#{name}.php`
|
9
|
+
end
|
10
|
+
|
11
|
+
def sphinx_create_client
|
12
|
+
@sphinx = Sphinx::Client.new
|
13
|
+
@sock = mock('SocketMock')
|
14
|
+
|
15
|
+
servers = @sphinx.instance_variable_get(:@servers)
|
16
|
+
servers.first.stub(:get_socket => @sock, :free_socket => nil)
|
17
|
+
@sphinx.stub!(:parse_response).and_raise(SphinxSpecError)
|
18
|
+
return @sphinx
|
19
|
+
end
|
20
|
+
|
21
|
+
def sphinx_safe_call
|
22
|
+
yield
|
23
|
+
rescue SphinxSpecError
|
24
|
+
end
|
data/sphinx.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{sphinx}
|
8
|
-
s.version = "0.9.10"
|
8
|
+
s.version = "0.9.10.2043"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Dmytro Shteflyuk"]
|
12
|
-
s.date = %q{2009-11-
|
12
|
+
s.date = %q{2009-11-16}
|
13
13
|
s.description = %q{An easy interface to Sphinx standalone full-text search engine. It is implemented as plugin for Ruby on Rails, but can be easily used as standalone library.}
|
14
14
|
s.email = %q{kpumuk@kpumuk.info}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -21,13 +21,16 @@ Gem::Specification.new do |s|
|
|
21
21
|
"Rakefile",
|
22
22
|
"VERSION.yml",
|
23
23
|
"init.rb",
|
24
|
-
"install.rb",
|
25
24
|
"lib/sphinx.rb",
|
25
|
+
"lib/sphinx/buffered_io.rb",
|
26
26
|
"lib/sphinx/client.rb",
|
27
27
|
"lib/sphinx/request.rb",
|
28
28
|
"lib/sphinx/response.rb",
|
29
|
+
"lib/sphinx/server.rb",
|
30
|
+
"lib/sphinx/timeout.rb",
|
29
31
|
"spec/client_response_spec.rb",
|
30
32
|
"spec/client_spec.rb",
|
33
|
+
"spec/client_validations_spec.rb",
|
31
34
|
"spec/fixtures/default_search.php",
|
32
35
|
"spec/fixtures/default_search_index.php",
|
33
36
|
"spec/fixtures/excerpt_custom.php",
|
@@ -92,12 +95,11 @@ Gem::Specification.new do |s|
|
|
92
95
|
"spec/fixtures/update_attributes.php",
|
93
96
|
"spec/fixtures/update_attributes_mva.php",
|
94
97
|
"spec/fixtures/weights.php",
|
98
|
+
"spec/spec_helper.rb",
|
95
99
|
"spec/sphinx/sphinx-id64.conf",
|
96
100
|
"spec/sphinx/sphinx.conf",
|
97
101
|
"spec/sphinx/sphinx_test.sql",
|
98
|
-
"sphinx.gemspec"
|
99
|
-
"sphinx.yml.tpl",
|
100
|
-
"tasks/sphinx.rake"
|
102
|
+
"sphinx.gemspec"
|
101
103
|
]
|
102
104
|
s.homepage = %q{http://github.com/kpumuk/sphinx}
|
103
105
|
s.rdoc_options = ["--charset=UTF-8"]
|
@@ -106,7 +108,9 @@ Gem::Specification.new do |s|
|
|
106
108
|
s.summary = %q{Sphinx Client API for Ruby}
|
107
109
|
s.test_files = [
|
108
110
|
"spec/client_response_spec.rb",
|
109
|
-
"spec/client_spec.rb"
|
111
|
+
"spec/client_spec.rb",
|
112
|
+
"spec/client_validations_spec.rb",
|
113
|
+
"spec/spec_helper.rb"
|
110
114
|
]
|
111
115
|
|
112
116
|
if s.respond_to? :specification_version then
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sphinx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.10
|
4
|
+
version: 0.9.10.2043
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmytro Shteflyuk
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-11-
|
12
|
+
date: 2009-11-16 00:00:00 +02:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -27,13 +27,16 @@ files:
|
|
27
27
|
- Rakefile
|
28
28
|
- VERSION.yml
|
29
29
|
- init.rb
|
30
|
-
- install.rb
|
31
30
|
- lib/sphinx.rb
|
31
|
+
- lib/sphinx/buffered_io.rb
|
32
32
|
- lib/sphinx/client.rb
|
33
33
|
- lib/sphinx/request.rb
|
34
34
|
- lib/sphinx/response.rb
|
35
|
+
- lib/sphinx/server.rb
|
36
|
+
- lib/sphinx/timeout.rb
|
35
37
|
- spec/client_response_spec.rb
|
36
38
|
- spec/client_spec.rb
|
39
|
+
- spec/client_validations_spec.rb
|
37
40
|
- spec/fixtures/default_search.php
|
38
41
|
- spec/fixtures/default_search_index.php
|
39
42
|
- spec/fixtures/excerpt_custom.php
|
@@ -98,12 +101,11 @@ files:
|
|
98
101
|
- spec/fixtures/update_attributes.php
|
99
102
|
- spec/fixtures/update_attributes_mva.php
|
100
103
|
- spec/fixtures/weights.php
|
104
|
+
- spec/spec_helper.rb
|
101
105
|
- spec/sphinx/sphinx-id64.conf
|
102
106
|
- spec/sphinx/sphinx.conf
|
103
107
|
- spec/sphinx/sphinx_test.sql
|
104
108
|
- sphinx.gemspec
|
105
|
-
- sphinx.yml.tpl
|
106
|
-
- tasks/sphinx.rake
|
107
109
|
has_rdoc: true
|
108
110
|
homepage: http://github.com/kpumuk/sphinx
|
109
111
|
licenses: []
|
@@ -135,3 +137,5 @@ summary: Sphinx Client API for Ruby
|
|
135
137
|
test_files:
|
136
138
|
- spec/client_response_spec.rb
|
137
139
|
- spec/client_spec.rb
|
140
|
+
- spec/client_validations_spec.rb
|
141
|
+
- spec/spec_helper.rb
|
data/install.rb
DELETED
data/sphinx.yml.tpl
DELETED
data/tasks/sphinx.rake
DELETED
@@ -1,75 +0,0 @@
|
|
1
|
-
namespace :sphinx do
|
2
|
-
desc 'Run indexer for configured indexes'
|
3
|
-
task :index do
|
4
|
-
config = load_config
|
5
|
-
if config[:indexes]
|
6
|
-
system "#{config[:root_dir]}/indexer --config \"#{config[:config_file]}\" #{config[:indexes]}"
|
7
|
-
else
|
8
|
-
puts 'You should specify indexes in sphinx.yml'
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
desc 'Run indexer for all indexes'
|
13
|
-
task :index_all do
|
14
|
-
config = load_config
|
15
|
-
system "#{config[:root_dir]}/indexer --config \"#{config[:config_file]}\" --all"
|
16
|
-
end
|
17
|
-
|
18
|
-
desc 'Rotate configured indexes and restart searchd server'
|
19
|
-
task :rotate do
|
20
|
-
config = load_config
|
21
|
-
if config[:indexes]
|
22
|
-
system "#{config[:root_dir]}/indexer --config \"#{config[:config_file]}\" --rotate #{config[:indexes]}"
|
23
|
-
else
|
24
|
-
puts 'You should specify indexes in sphinx.yml'
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
desc 'Rotate all indexes and restart searchd server'
|
29
|
-
task :rotate_all do
|
30
|
-
config = load_config
|
31
|
-
system "#{config[:root_dir]}/indexer --config \"#{config[:config_file]}\" --rotate --all"
|
32
|
-
end
|
33
|
-
|
34
|
-
desc 'Start searchd server'
|
35
|
-
task :start do
|
36
|
-
config = load_config
|
37
|
-
if File.exists?(config[:pid_file])
|
38
|
-
puts 'Sphinx searchd server is already started.'
|
39
|
-
else
|
40
|
-
system "#{config[:root_dir]}/searchd --config \"#{config[:config_file]}\""
|
41
|
-
puts 'Sphinx searchd server started.'
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
desc 'Stop searchd server'
|
46
|
-
task :stop do
|
47
|
-
config = load_config
|
48
|
-
unless File.exists?(config[:pid_file])
|
49
|
-
puts 'Sphinx searchd server is not running.'
|
50
|
-
else
|
51
|
-
pid = File.read(config[:pid_file]).chomp
|
52
|
-
kill 'SIGHUP', pid
|
53
|
-
puts 'Sphinx searchd server stopped.'
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
desc 'Restart searchd server'
|
58
|
-
task :restart => [:stop, :start]
|
59
|
-
|
60
|
-
def load_config
|
61
|
-
return @sphinx_config if @sphinx_config
|
62
|
-
|
63
|
-
options = YAML.load_file(File.dirname(__FILE__) + '/../../../../config/sphinx.yml') rescue {}
|
64
|
-
@sphinx_config = {
|
65
|
-
:config_file => options['config_file'] || '/etc/sphinx.conf',
|
66
|
-
:root_dir => options['root_dir'] || '/usr/bin',
|
67
|
-
:indexes => options['indexes']
|
68
|
-
}
|
69
|
-
sphinx_config = File.read(@sphinx_config[:config_file]) rescue ''
|
70
|
-
|
71
|
-
sphinx_config =~ /searchd\s*{.*pid_file\s*=\s*(.*?)\n.*}/m
|
72
|
-
@sphinx_config[:pid_file] = $1 || '/var/run/searchd.pid'
|
73
|
-
return @sphinx_config
|
74
|
-
end
|
75
|
-
end
|