freelancing-god-thinking-sphinx 1.1.17 → 1.1.18
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +2 -0
- data/lib/thinking_sphinx.rb +3 -2
- data/lib/thinking_sphinx/configuration.rb +2 -3
- data/lib/thinking_sphinx/search.rb +2 -2
- data/spec/unit/thinking_sphinx/search_spec.rb +22 -4
- data/tasks/distribution.rb +18 -0
- data/vendor/riddle/lib/riddle.rb +1 -1
- data/vendor/riddle/lib/riddle/configuration/section.rb +7 -1
- metadata +19 -3
data/README.textile
CHANGED
data/lib/thinking_sphinx.rb
CHANGED
@@ -37,7 +37,7 @@ module ThinkingSphinx
|
|
37
37
|
module Version #:nodoc:
|
38
38
|
Major = 1
|
39
39
|
Minor = 1
|
40
|
-
Tiny =
|
40
|
+
Tiny = 18
|
41
41
|
|
42
42
|
String = [Major, Minor, Tiny].join('.')
|
43
43
|
end
|
@@ -175,7 +175,8 @@ module ThinkingSphinx
|
|
175
175
|
end
|
176
176
|
|
177
177
|
def self.mysql?
|
178
|
-
::ActiveRecord::Base.connection.class.name.demodulize == "MysqlAdapter" ||
|
178
|
+
::ActiveRecord::Base.connection.class.name.demodulize == "MysqlAdapter" ||
|
179
|
+
::ActiveRecord::Base.connection.class.name.demodulize == "MysqlplusAdapter" || (
|
179
180
|
jruby? && ::ActiveRecord::Base.connection.config[:adapter] == "jdbcmysql"
|
180
181
|
)
|
181
182
|
end
|
@@ -19,7 +19,7 @@ module ThinkingSphinx
|
|
19
19
|
# min infix length:: 1
|
20
20
|
# mem limit:: 64M
|
21
21
|
# max matches:: 1000
|
22
|
-
# morphology::
|
22
|
+
# morphology:: nil
|
23
23
|
# charset type:: utf-8
|
24
24
|
# charset table:: nil
|
25
25
|
# ignore chars:: nil
|
@@ -103,8 +103,7 @@ module ThinkingSphinx
|
|
103
103
|
|
104
104
|
self.source_options = {}
|
105
105
|
self.index_options = {
|
106
|
-
:charset_type => "utf-8"
|
107
|
-
:morphology => "stem_en"
|
106
|
+
:charset_type => "utf-8"
|
108
107
|
}
|
109
108
|
|
110
109
|
parse_config
|
@@ -461,10 +461,10 @@ module ThinkingSphinx
|
|
461
461
|
page = options[:page] ? options[:page].to_i : 1
|
462
462
|
page = 1 if page <= 0
|
463
463
|
client.offset = (page - 1) * client.limit
|
464
|
-
|
464
|
+
|
465
465
|
begin
|
466
466
|
log "Sphinx: #{query}"
|
467
|
-
results = client.query
|
467
|
+
results = client.query(query, '*', options[:comment] || '')
|
468
468
|
log "Sphinx Result:"
|
469
469
|
log results[:matches].collect { |m|
|
470
470
|
m[:attributes]["sphinx_internal_id"]
|
@@ -27,24 +27,24 @@ describe ThinkingSphinx::Search do
|
|
27
27
|
|
28
28
|
it "should not apply by default" do
|
29
29
|
ThinkingSphinx::Search.search "foo bar"
|
30
|
-
@client.should have_received(:query).with("foo bar")
|
30
|
+
@client.should have_received(:query).with("foo bar",'*','')
|
31
31
|
end
|
32
32
|
|
33
33
|
it "should apply when passed, and handle full extended syntax" do
|
34
34
|
input = %{a b* c (d | e) 123 5&6 (f_f g) !h "i j" "k l"~10 "m n"/3 @o p -(q|r)}
|
35
35
|
expected = %{*a* b* *c* (*d* | *e*) *123* *5*&*6* (*f_f* *g*) !*h* "i j" "k l"~10 "m n"/3 @o *p* -(*q*|*r*)}
|
36
36
|
ThinkingSphinx::Search.search input, :star => true
|
37
|
-
@client.should have_received(:query).with(expected)
|
37
|
+
@client.should have_received(:query).with(expected,'*','')
|
38
38
|
end
|
39
39
|
|
40
40
|
it "should default to /\w+/ as token" do
|
41
41
|
ThinkingSphinx::Search.search "foo@bar.com", :star => true
|
42
|
-
@client.should have_received(:query).with("*foo*@*bar*.*com*")
|
42
|
+
@client.should have_received(:query).with("*foo*@*bar*.*com*",'*','')
|
43
43
|
end
|
44
44
|
|
45
45
|
it "should honour custom token" do
|
46
46
|
ThinkingSphinx::Search.search "foo@bar.com -foo-bar", :star => /[\w@.-]+/u
|
47
|
-
@client.should have_received(:query).with("*foo@bar.com* -*foo-bar*")
|
47
|
+
@client.should have_received(:query).with("*foo@bar.com* -*foo-bar*",'*','')
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
@@ -85,6 +85,24 @@ describe ThinkingSphinx::Search do
|
|
85
85
|
@client.sort_mode.should == :attr_desc
|
86
86
|
end
|
87
87
|
end
|
88
|
+
|
89
|
+
describe ":comment option" do
|
90
|
+
before :each do
|
91
|
+
@client = Riddle::Client.new
|
92
|
+
@client.stub_method(:query => {:matches => []})
|
93
|
+
Riddle::Client.stub_method(:new => @client)
|
94
|
+
end
|
95
|
+
|
96
|
+
it "should add comment to log" do
|
97
|
+
ThinkingSphinx::Search.search 'foo bar', :comment => 'custom log'
|
98
|
+
@client.should have_received(:query).with('foo bar', '*', 'custom log')
|
99
|
+
end
|
100
|
+
|
101
|
+
it "should use a blank string when no comment is specified" do
|
102
|
+
ThinkingSphinx::Search.search 'foo bar'
|
103
|
+
@client.should have_received(:query).with('foo bar', '*', '')
|
104
|
+
end
|
105
|
+
end
|
88
106
|
end
|
89
107
|
|
90
108
|
describe "facets method" do
|
data/tasks/distribution.rb
CHANGED
@@ -34,6 +34,24 @@ spec = Gem::Specification.new do |s|
|
|
34
34
|
"tasks/**/*.rake",
|
35
35
|
"vendor/**/*"
|
36
36
|
]
|
37
|
+
s.post_install_message = <<-MESSAGE
|
38
|
+
With the release of Thinking Sphinx 1.1.18, there is one important change to
|
39
|
+
note: previously, the default morphology for indexing was 'stem_en'. The new
|
40
|
+
default is nil, to avoid any unexpected behavior. If you wish to keep the old
|
41
|
+
value though, you will need to add the following settings to your
|
42
|
+
config/sphinx.yml file:
|
43
|
+
|
44
|
+
development:
|
45
|
+
morphology: stem_en
|
46
|
+
test:
|
47
|
+
morphology: stem_en
|
48
|
+
production:
|
49
|
+
morphology: stem_en
|
50
|
+
|
51
|
+
To understand morphologies/stemmers better, visit the following link:
|
52
|
+
http://www.sphinxsearch.com/docs/manual-0.9.8.html#conf-morphology
|
53
|
+
|
54
|
+
MESSAGE
|
37
55
|
end
|
38
56
|
|
39
57
|
Rake::GemPackageTask.new(spec) do |p|
|
data/vendor/riddle/lib/riddle.rb
CHANGED
@@ -18,7 +18,7 @@ module Riddle #:nodoc:
|
|
18
18
|
Rev = 1533
|
19
19
|
# Release number to mark my own fixes, beyond feature parity with
|
20
20
|
# Sphinx itself.
|
21
|
-
Release =
|
21
|
+
Release = 5
|
22
22
|
|
23
23
|
String = [Major, Minor, Tiny].join('.')
|
24
24
|
GemVersion = [Major, Minor, Tiny, Rev, Release].join('.')
|
@@ -30,7 +30,13 @@ module Riddle
|
|
30
30
|
|
31
31
|
def setting_to_array(setting)
|
32
32
|
value = send(setting)
|
33
|
-
|
33
|
+
case value
|
34
|
+
when Array then value
|
35
|
+
when TrueClass then [1]
|
36
|
+
when FalseClass then [0]
|
37
|
+
else
|
38
|
+
[value]
|
39
|
+
end
|
34
40
|
end
|
35
41
|
end
|
36
42
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: freelancing-god-thinking-sphinx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pat Allan
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-05-
|
12
|
+
date: 2009-05-27 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -125,7 +125,23 @@ files:
|
|
125
125
|
- spec/unit/thinking_sphinx_spec.rb
|
126
126
|
has_rdoc: true
|
127
127
|
homepage: http://ts.freelancing-gods.com
|
128
|
-
post_install_message:
|
128
|
+
post_install_message: |+
|
129
|
+
With the release of Thinking Sphinx 1.1.18, there is one important change to
|
130
|
+
note: previously, the default morphology for indexing was 'stem_en'. The new
|
131
|
+
default is nil, to avoid any unexpected behavior. If you wish to keep the old
|
132
|
+
value though, you will need to add the following settings to your
|
133
|
+
config/sphinx.yml file:
|
134
|
+
|
135
|
+
development:
|
136
|
+
morphology: stem_en
|
137
|
+
test:
|
138
|
+
morphology: stem_en
|
139
|
+
production:
|
140
|
+
morphology: stem_en
|
141
|
+
|
142
|
+
To understand morphologies/stemmers better, visit the following link:
|
143
|
+
http://www.sphinxsearch.com/docs/manual-0.9.8.html#conf-morphology
|
144
|
+
|
129
145
|
rdoc_options:
|
130
146
|
- --title
|
131
147
|
- Thinking Sphinx -- Rails/Merb Sphinx Plugin
|