riddle 1.5.5 → 1.5.6
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +6 -6
- data/HISTORY +6 -0
- data/lib/riddle.rb +9 -10
- data/lib/riddle/client.rb +7 -1
- data/lib/riddle/configuration/indexer.rb +1 -1
- data/lib/riddle/configuration/parser.rb +1 -1
- data/lib/riddle/query/select.rb +1 -1
- data/riddle.gemspec +1 -2
- data/spec/functional/connection_spec.rb +6 -6
- metadata +4 -5
- data/lib/riddle/version.rb +0 -3
data/.travis.yml
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
language: ruby
|
2
2
|
before_install:
|
3
|
-
- curl -O http://fs-packages.s3.amazonaws.com/fs-sphinx-1.
|
4
|
-
- sudo dpkg -i fs-sphinx-1.
|
5
|
-
- curl -O http://fs-packages.s3.amazonaws.com/fs-sphinx-2.0.
|
6
|
-
- sudo dpkg -i fs-sphinx-2.0.
|
7
|
-
- curl -O http://fs-packages.s3.amazonaws.com/fs-sphinx-2.0.
|
8
|
-
- sudo dpkg -i fs-sphinx-2.0.
|
3
|
+
- curl -O http://fs-packages.s3.amazonaws.com/fs-sphinx-1.10_x86_64_12.04.deb
|
4
|
+
- sudo dpkg -i fs-sphinx-1.10_x86_64_12.04.deb
|
5
|
+
- curl -O http://fs-packages.s3.amazonaws.com/fs-sphinx-2.0.4_x86_64_12.04.deb
|
6
|
+
- sudo dpkg -i fs-sphinx-2.0.4_x86_64_12.04.deb
|
7
|
+
- curl -O http://fs-packages.s3.amazonaws.com/fs-sphinx-2.0.6_x86_64_12.04.deb
|
8
|
+
- sudo dpkg -i fs-sphinx-2.0.6_x86_64_12.04.deb
|
9
9
|
rvm:
|
10
10
|
- 1.8.7
|
11
11
|
- 1.9.2
|
data/HISTORY
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
1.5.6 - May 7th 2013
|
2
|
+
- Wrap underlying parse errors within Riddle::ResponseError instances when parsing responses.
|
3
|
+
- Add lemmatization options (Kirill Lazarev).
|
4
|
+
- Ignore configuration lines that are only comments when parsing configurations.
|
5
|
+
- Construct GROUP ORDER and ORDER in SphinxQL in the correct order (Grzegorz Derebecki).
|
6
|
+
|
1
7
|
1.5.5 - February 23rd 2013
|
2
8
|
- Added Riddle::Query.escape for SphinxQL queries.
|
3
9
|
- Fixed failover handling (Ngan Pham).
|
data/lib/riddle.rb
CHANGED
@@ -7,7 +7,7 @@ module Riddle #:nodoc:
|
|
7
7
|
@@escape_pattern = /[\(\)\|\-!@~"&\/]/
|
8
8
|
@@use_encoding = defined?(::Encoding) &&
|
9
9
|
::Encoding.respond_to?(:default_external)
|
10
|
-
|
10
|
+
|
11
11
|
class ConnectionError < StandardError #:nodoc:
|
12
12
|
#
|
13
13
|
end
|
@@ -19,36 +19,36 @@ module Riddle #:nodoc:
|
|
19
19
|
data
|
20
20
|
end
|
21
21
|
end
|
22
|
-
|
22
|
+
|
23
23
|
def self.mutex
|
24
24
|
@@mutex
|
25
25
|
end
|
26
|
-
|
26
|
+
|
27
27
|
def self.escape_pattern
|
28
28
|
@@escape_pattern
|
29
29
|
end
|
30
|
-
|
30
|
+
|
31
31
|
def self.escape_pattern=(pattern)
|
32
32
|
mutex.synchronize do
|
33
33
|
@@escape_pattern = pattern
|
34
34
|
end
|
35
35
|
end
|
36
|
-
|
36
|
+
|
37
37
|
def self.escape(string)
|
38
38
|
string.gsub(escape_pattern) { |char| "\\#{char}" }
|
39
39
|
end
|
40
|
-
|
40
|
+
|
41
41
|
def self.loaded_version
|
42
42
|
@@sphinx_version
|
43
43
|
end
|
44
|
-
|
44
|
+
|
45
45
|
def self.loaded_version=(version)
|
46
46
|
@@sphinx_version = version
|
47
47
|
end
|
48
|
-
|
48
|
+
|
49
49
|
def self.version_warning
|
50
50
|
return if loaded_version
|
51
|
-
|
51
|
+
|
52
52
|
STDERR.puts %Q{
|
53
53
|
Riddle cannot detect Sphinx on your machine, and so can't determine which
|
54
54
|
version of Sphinx you are planning on using. Please use one of the following
|
@@ -70,7 +70,6 @@ require 'riddle/client'
|
|
70
70
|
require 'riddle/configuration'
|
71
71
|
require 'riddle/controller'
|
72
72
|
require 'riddle/query'
|
73
|
-
require 'riddle/version'
|
74
73
|
|
75
74
|
Riddle.loaded_version = nil
|
76
75
|
Riddle::AutoVersion.configure
|
data/lib/riddle/client.rb
CHANGED
@@ -4,7 +4,9 @@ require 'riddle/client/response'
|
|
4
4
|
|
5
5
|
module Riddle
|
6
6
|
class VersionError < StandardError; end
|
7
|
-
class ResponseError < StandardError
|
7
|
+
class ResponseError < StandardError
|
8
|
+
attr_accessor :original
|
9
|
+
end
|
8
10
|
class OutOfBoundsError < StandardError; end
|
9
11
|
|
10
12
|
# This class was heavily based on the existing Client API by Dmytro Shteflyuk
|
@@ -290,6 +292,10 @@ module Riddle
|
|
290
292
|
|
291
293
|
@queue.clear
|
292
294
|
results
|
295
|
+
rescue => original
|
296
|
+
error = ResponseError.new original.message
|
297
|
+
error.original = original
|
298
|
+
raise error
|
293
299
|
end
|
294
300
|
|
295
301
|
# Query the Sphinx daemon - defaulting to all indices, but you can specify
|
data/lib/riddle/query/select.rb
CHANGED
@@ -84,10 +84,10 @@ class Riddle::Query::Select
|
|
84
84
|
sql = "SELECT #{ @values.join(', ') } FROM #{ @indices.join(', ') }"
|
85
85
|
sql << " WHERE #{ combined_wheres }" if wheres?
|
86
86
|
sql << " GROUP BY #{@group_by}" if !@group_by.nil?
|
87
|
-
sql << " ORDER BY #{@order_by}" if !@order_by.nil?
|
88
87
|
unless @order_within_group_by.nil?
|
89
88
|
sql << " WITHIN GROUP ORDER BY #{@order_within_group_by}"
|
90
89
|
end
|
90
|
+
sql << " ORDER BY #{@order_by}" if !@order_by.nil?
|
91
91
|
sql << " #{limit_clause}" unless @limit.nil? && @offset.nil?
|
92
92
|
sql << " #{options_clause}" unless @options.empty?
|
93
93
|
|
data/riddle.gemspec
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
$:.push File.expand_path('../lib', __FILE__)
|
3
|
-
require 'riddle/version'
|
4
3
|
|
5
4
|
Gem::Specification.new do |s|
|
6
5
|
s.name = 'riddle'
|
7
|
-
s.version =
|
6
|
+
s.version = '1.5.6'
|
8
7
|
s.platform = Gem::Platform::RUBY
|
9
8
|
s.authors = ['Pat Allan']
|
10
9
|
s.email = ['pat@freelancing-gods.com']
|
@@ -8,7 +8,7 @@ describe 'Sphinx Client', :live => true do
|
|
8
8
|
after :each do
|
9
9
|
Riddle::Client.connection = nil
|
10
10
|
end
|
11
|
-
|
11
|
+
|
12
12
|
describe '.connection' do
|
13
13
|
it "should use the given block" do
|
14
14
|
Riddle::Client.connection = lambda { |client|
|
@@ -16,16 +16,16 @@ describe 'Sphinx Client', :live => true do
|
|
16
16
|
}
|
17
17
|
client.query('smith').should be_kind_of(Hash)
|
18
18
|
end
|
19
|
-
|
19
|
+
|
20
20
|
it "should fail with errors from the given block" do
|
21
21
|
Riddle::Client.connection = lambda { |client|
|
22
22
|
raise RiddleSpecConnectionProcError
|
23
23
|
}
|
24
24
|
lambda { client.query('smith') }.
|
25
|
-
should raise_error(
|
25
|
+
should raise_error(Riddle::ResponseError)
|
26
26
|
end
|
27
27
|
end
|
28
|
-
|
28
|
+
|
29
29
|
describe '#connection' do
|
30
30
|
it "use the given block" do
|
31
31
|
client.connection = lambda { |client|
|
@@ -39,7 +39,7 @@ describe 'Sphinx Client', :live => true do
|
|
39
39
|
raise RiddleSpecConnectionProcError
|
40
40
|
}
|
41
41
|
lambda { client.query('smith') }.
|
42
|
-
should raise_error(
|
42
|
+
should raise_error(Riddle::ResponseError)
|
43
43
|
end
|
44
44
|
|
45
45
|
it "should prioritise instance over class connection" do
|
@@ -49,7 +49,7 @@ describe 'Sphinx Client', :live => true do
|
|
49
49
|
client.connection = lambda { |client|
|
50
50
|
TCPSocket.new(client.server, client.port)
|
51
51
|
}
|
52
|
-
|
52
|
+
|
53
53
|
lambda { client.query('smith') }.should_not raise_error
|
54
54
|
end
|
55
55
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: riddle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 1.5.
|
9
|
+
- 6
|
10
|
+
version: 1.5.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Pat Allan
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2013-
|
18
|
+
date: 2013-05-07 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -117,7 +117,6 @@ files:
|
|
117
117
|
- lib/riddle/query/delete.rb
|
118
118
|
- lib/riddle/query/insert.rb
|
119
119
|
- lib/riddle/query/select.rb
|
120
|
-
- lib/riddle/version.rb
|
121
120
|
- riddle.gemspec
|
122
121
|
- spec/fixtures/.gitignore
|
123
122
|
- spec/fixtures/data/0.9.9/anchor.bin
|
data/lib/riddle/version.rb
DELETED