thinking-sphinx 2.0.11 → 2.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/HISTORY +23 -2
- data/README.textile +5 -0
- data/features/attribute_transformation.feature +4 -4
- data/features/support/env.rb +0 -1
- data/features/thinking_sphinx/db/fixtures/alphas.rb +8 -10
- data/lib/cucumber/thinking_sphinx/internal_world.rb +7 -2
- data/lib/cucumber/thinking_sphinx/sql_logger.rb +16 -4
- data/lib/thinking_sphinx/active_record.rb +5 -1
- data/lib/thinking_sphinx/adapters/postgresql_adapter.rb +14 -5
- data/lib/thinking_sphinx/attribute.rb +3 -3
- data/lib/thinking_sphinx/auto_version.rb +2 -2
- data/lib/thinking_sphinx/configuration.rb +8 -0
- data/lib/thinking_sphinx/deploy/capistrano.rb +1 -1
- data/lib/thinking_sphinx/facet.rb +19 -19
- data/lib/thinking_sphinx/index.rb +3 -1
- data/lib/thinking_sphinx/index/builder.rb +5 -0
- data/lib/thinking_sphinx/property.rb +43 -41
- data/lib/thinking_sphinx/search.rb +23 -4
- data/lib/thinking_sphinx/source.rb +5 -5
- data/lib/thinking_sphinx/source/sql.rb +33 -16
- data/lib/thinking_sphinx/version.rb +1 -1
- data/spec/fixtures/models.rb +3 -0
- data/spec/spec_helper.rb +0 -1
- data/spec/sphinx_helper.rb +7 -1
- data/spec/thinking_sphinx/active_record_spec.rb +15 -0
- data/spec/thinking_sphinx/auto_version_spec.rb +8 -0
- data/spec/thinking_sphinx/index/builder_spec.rb +126 -105
- data/spec/thinking_sphinx/index_spec.rb +6 -0
- data/spec/thinking_sphinx/search_spec.rb +27 -6
- data/spec/thinking_sphinx/source_spec.rb +17 -3
- metadata +63 -64
@@ -178,6 +178,12 @@ describe ThinkingSphinx::Index do
|
|
178
178
|
|
179
179
|
index.to_riddle(0).last.local_indices.should include('beta_delta')
|
180
180
|
end
|
181
|
+
|
182
|
+
it "should add additional local indexes if there are any" do
|
183
|
+
index = ThinkingSphinx::Index.new(Alpha)
|
184
|
+
index.additional_indices << "other_index_core"
|
185
|
+
index.to_riddle(0).last.local_indices.should include('other_index_core')
|
186
|
+
end
|
181
187
|
end
|
182
188
|
end
|
183
189
|
end
|
@@ -32,6 +32,15 @@ describe ThinkingSphinx::Search do
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
+
describe '#==' do
|
36
|
+
it "populates the search results when checking equality" do
|
37
|
+
search = ThinkingSphinx::Search.new
|
38
|
+
search == []
|
39
|
+
|
40
|
+
search.should be_populated
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
35
44
|
describe '#populated?' do
|
36
45
|
before :each do
|
37
46
|
@search = ThinkingSphinx::Search.new
|
@@ -215,8 +224,8 @@ describe ThinkingSphinx::Search do
|
|
215
224
|
:matches => minimal_result_hashes(@alpha_a, @beta_b, @alpha_b, @beta_a),
|
216
225
|
:fields => ["one", "two", "three", "four", "five"]
|
217
226
|
}
|
218
|
-
Alpha.stub! :find => [@alpha_a, @alpha_b]
|
219
|
-
Beta.stub! :find => [@beta_a, @beta_b]
|
227
|
+
Alpha.stub! :find => [@alpha_a, @alpha_b], :unscoped => Alpha
|
228
|
+
Beta.stub! :find => [@beta_a, @beta_b], :unscoped => Beta
|
220
229
|
end
|
221
230
|
|
222
231
|
it "should issue only one select per model" do
|
@@ -505,7 +514,7 @@ describe ThinkingSphinx::Search do
|
|
505
514
|
filter = @client.filters.last
|
506
515
|
filter.values.should == [
|
507
516
|
Parent.to_crc32, Admin::Person.to_crc32,
|
508
|
-
Child.to_crc32, Person.to_crc32
|
517
|
+
Child.to_crc32, Teenager.to_crc32, Person.to_crc32
|
509
518
|
]
|
510
519
|
filter.attribute.should == 'class_crc'
|
511
520
|
filter.exclude?.should be_false
|
@@ -904,6 +913,18 @@ describe ThinkingSphinx::Search do
|
|
904
913
|
end
|
905
914
|
end
|
906
915
|
|
916
|
+
describe ':attributes_only option' do
|
917
|
+
it "returns the attributes as hashes with values" do
|
918
|
+
ThinkingSphinx::Search.new(
|
919
|
+
:attributes_only => true
|
920
|
+
).first.should == {
|
921
|
+
:sphinx_internal_class => "Alpha",
|
922
|
+
:class_crc => Alpha.to_crc32,
|
923
|
+
:sphinx_internal_id => 1
|
924
|
+
}
|
925
|
+
end
|
926
|
+
end
|
927
|
+
|
907
928
|
context 'result objects' do
|
908
929
|
describe '#excerpts' do
|
909
930
|
before :each do
|
@@ -1150,7 +1171,7 @@ describe ThinkingSphinx::Search do
|
|
1150
1171
|
}
|
1151
1172
|
}]
|
1152
1173
|
}
|
1153
|
-
Alpha.stub
|
1174
|
+
Alpha.stub :find => [@alpha], :unscoped => Alpha
|
1154
1175
|
end
|
1155
1176
|
|
1156
1177
|
it "should yield the match, group and count" do
|
@@ -1186,7 +1207,7 @@ describe ThinkingSphinx::Search do
|
|
1186
1207
|
}, :weight => 12
|
1187
1208
|
}]
|
1188
1209
|
}
|
1189
|
-
Alpha.stub
|
1210
|
+
Alpha.stub :find => [@alpha], :unscoped => Alpha
|
1190
1211
|
end
|
1191
1212
|
|
1192
1213
|
it "should yield the match and weight" do
|
@@ -1215,7 +1236,7 @@ describe ThinkingSphinx::Search do
|
|
1215
1236
|
}, :weight => 12
|
1216
1237
|
}]
|
1217
1238
|
}
|
1218
|
-
Alpha.stub
|
1239
|
+
Alpha.stub :find => [@alpha], :unscoped => Alpha
|
1219
1240
|
|
1220
1241
|
@search = ThinkingSphinx::Search.new
|
1221
1242
|
end
|
@@ -85,13 +85,17 @@ describe ThinkingSphinx::Source do
|
|
85
85
|
@riddle.sql_host.should == config[:host]
|
86
86
|
@riddle.sql_port.should == config[:port]
|
87
87
|
@riddle.sql_sock.should == config[:socket]
|
88
|
+
|
89
|
+
@riddle.mysql_ssl_ca.should == config[:sslca]
|
90
|
+
@riddle.mysql_ssl_cert.should == config[:sslcert]
|
91
|
+
@riddle.mysql_ssl_key.should == config[:sslkey]
|
88
92
|
end
|
89
93
|
|
90
94
|
it "should use a environment user if nothing else is provided" do
|
91
95
|
Person.connection.stub!(:instance_variable_get => {
|
92
|
-
|
93
|
-
|
94
|
-
|
96
|
+
:user => nil,
|
97
|
+
:username => nil
|
98
|
+
})
|
95
99
|
@source = ThinkingSphinx::Source.new(@index)
|
96
100
|
|
97
101
|
riddle = @source.to_riddle_for_core(1, 0)
|
@@ -161,6 +165,16 @@ describe ThinkingSphinx::Source do
|
|
161
165
|
it "should include any defined groupings" do
|
162
166
|
@query.should match(/GROUP BY.+`first_name`/)
|
163
167
|
end
|
168
|
+
|
169
|
+
it "should include descendants" do
|
170
|
+
index = ThinkingSphinx::Index.new(Child)
|
171
|
+
source = ThinkingSphinx::Source.new(index, :sql_range_step => 1000)
|
172
|
+
riddle = source.to_riddle_for_core(1, 0)
|
173
|
+
query = riddle.sql_query
|
174
|
+
|
175
|
+
query.should match(/WHERE.+`people`\.`type`.+'Child'.+ 'Teenager'\)/)
|
176
|
+
query.should_not match(/WHERE.+"users"."type" = 'Employee'/)
|
177
|
+
end
|
164
178
|
end
|
165
179
|
|
166
180
|
describe "#sql_query_range" do
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thinking-sphinx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 2.0.
|
9
|
+
- 12
|
10
|
+
version: 2.0.12
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Pat Allan
|
@@ -15,12 +15,11 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-
|
19
|
-
default_executable:
|
18
|
+
date: 2012-05-14 00:00:00 Z
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
22
|
-
|
23
|
-
|
21
|
+
type: :runtime
|
22
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
23
|
none: false
|
25
24
|
requirements:
|
26
25
|
- - ">="
|
@@ -31,28 +30,28 @@ dependencies:
|
|
31
30
|
- 0
|
32
31
|
- 3
|
33
32
|
version: 3.0.3
|
34
|
-
|
33
|
+
version_requirements: *id001
|
35
34
|
prerelease: false
|
36
|
-
|
35
|
+
name: activerecord
|
37
36
|
- !ruby/object:Gem::Dependency
|
38
|
-
|
39
|
-
|
37
|
+
type: :runtime
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
40
39
|
none: false
|
41
40
|
requirements:
|
42
41
|
- - ">="
|
43
42
|
- !ruby/object:Gem::Version
|
44
|
-
hash:
|
43
|
+
hash: 7
|
45
44
|
segments:
|
46
45
|
- 1
|
47
46
|
- 5
|
48
|
-
-
|
49
|
-
version: 1.5.
|
50
|
-
|
47
|
+
- 2
|
48
|
+
version: 1.5.2
|
49
|
+
version_requirements: *id002
|
51
50
|
prerelease: false
|
52
|
-
|
51
|
+
name: riddle
|
53
52
|
- !ruby/object:Gem::Dependency
|
54
|
-
|
55
|
-
|
53
|
+
type: :runtime
|
54
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
56
55
|
none: false
|
57
56
|
requirements:
|
58
57
|
- - ">="
|
@@ -63,12 +62,12 @@ dependencies:
|
|
63
62
|
- 1
|
64
63
|
- 2
|
65
64
|
version: 2.1.2
|
66
|
-
|
65
|
+
version_requirements: *id003
|
67
66
|
prerelease: false
|
68
|
-
|
67
|
+
name: builder
|
69
68
|
- !ruby/object:Gem::Dependency
|
70
|
-
|
71
|
-
|
69
|
+
type: :development
|
70
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
72
71
|
none: false
|
73
72
|
requirements:
|
74
73
|
- - ">="
|
@@ -79,12 +78,28 @@ dependencies:
|
|
79
78
|
- 0
|
80
79
|
- 3
|
81
80
|
version: 3.0.3
|
81
|
+
version_requirements: *id004
|
82
|
+
prerelease: false
|
83
|
+
name: actionpack
|
84
|
+
- !ruby/object:Gem::Dependency
|
82
85
|
type: :development
|
86
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
87
|
+
none: false
|
88
|
+
requirements:
|
89
|
+
- - "="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
hash: 15
|
92
|
+
segments:
|
93
|
+
- 0
|
94
|
+
- 4
|
95
|
+
- 0
|
96
|
+
version: 0.4.0
|
97
|
+
version_requirements: *id005
|
83
98
|
prerelease: false
|
84
|
-
|
99
|
+
name: appraisal
|
85
100
|
- !ruby/object:Gem::Dependency
|
86
|
-
|
87
|
-
|
101
|
+
type: :development
|
102
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
88
103
|
none: false
|
89
104
|
requirements:
|
90
105
|
- - "="
|
@@ -95,12 +110,12 @@ dependencies:
|
|
95
110
|
- 0
|
96
111
|
- 2
|
97
112
|
version: 1.0.2
|
98
|
-
|
113
|
+
version_requirements: *id006
|
99
114
|
prerelease: false
|
100
|
-
|
115
|
+
name: cucumber
|
101
116
|
- !ruby/object:Gem::Dependency
|
102
|
-
|
103
|
-
|
117
|
+
type: :development
|
118
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
104
119
|
none: false
|
105
120
|
requirements:
|
106
121
|
- - "="
|
@@ -111,28 +126,12 @@ dependencies:
|
|
111
126
|
- 3
|
112
127
|
- 1
|
113
128
|
version: 0.3.1
|
114
|
-
|
129
|
+
version_requirements: *id007
|
115
130
|
prerelease: false
|
116
|
-
|
131
|
+
name: faker
|
117
132
|
- !ruby/object:Gem::Dependency
|
118
|
-
name: ginger
|
119
|
-
version_requirements: &id007 !ruby/object:Gem::Requirement
|
120
|
-
none: false
|
121
|
-
requirements:
|
122
|
-
- - "="
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
hash: 31
|
125
|
-
segments:
|
126
|
-
- 1
|
127
|
-
- 2
|
128
|
-
- 0
|
129
|
-
version: 1.2.0
|
130
133
|
type: :development
|
131
|
-
|
132
|
-
requirement: *id007
|
133
|
-
- !ruby/object:Gem::Dependency
|
134
|
-
name: rake
|
135
|
-
version_requirements: &id008 !ruby/object:Gem::Requirement
|
134
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
136
135
|
none: false
|
137
136
|
requirements:
|
138
137
|
- - ">="
|
@@ -143,12 +142,12 @@ dependencies:
|
|
143
142
|
- 9
|
144
143
|
- 2
|
145
144
|
version: 0.9.2
|
146
|
-
|
145
|
+
version_requirements: *id008
|
147
146
|
prerelease: false
|
148
|
-
|
147
|
+
name: rake
|
149
148
|
- !ruby/object:Gem::Dependency
|
150
|
-
|
151
|
-
|
149
|
+
type: :development
|
150
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
152
151
|
none: false
|
153
152
|
requirements:
|
154
153
|
- - "="
|
@@ -159,12 +158,12 @@ dependencies:
|
|
159
158
|
- 6
|
160
159
|
- 0
|
161
160
|
version: 2.6.0
|
162
|
-
|
161
|
+
version_requirements: *id009
|
163
162
|
prerelease: false
|
164
|
-
|
163
|
+
name: rspec
|
165
164
|
- !ruby/object:Gem::Dependency
|
166
|
-
|
167
|
-
|
165
|
+
type: :development
|
166
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
168
167
|
none: false
|
169
168
|
requirements:
|
170
169
|
- - "="
|
@@ -174,12 +173,12 @@ dependencies:
|
|
174
173
|
- 3
|
175
174
|
- 0
|
176
175
|
version: "3.0"
|
177
|
-
|
176
|
+
version_requirements: *id010
|
178
177
|
prerelease: false
|
179
|
-
|
178
|
+
name: will_paginate
|
180
179
|
- !ruby/object:Gem::Dependency
|
181
|
-
|
182
|
-
|
180
|
+
type: :development
|
181
|
+
requirement: &id011 !ruby/object:Gem::Requirement
|
183
182
|
none: false
|
184
183
|
requirements:
|
185
184
|
- - ">="
|
@@ -190,9 +189,9 @@ dependencies:
|
|
190
189
|
- 7
|
191
190
|
- 2
|
192
191
|
version: 0.7.2
|
193
|
-
|
192
|
+
version_requirements: *id011
|
194
193
|
prerelease: false
|
195
|
-
|
194
|
+
name: yard
|
196
195
|
description: A concise and easy-to-use Ruby library that connects ActiveRecord to the Sphinx search daemon, managing configuration, indexing and searching.
|
197
196
|
email:
|
198
197
|
- pat@freelancing-gods.com
|
@@ -377,7 +376,6 @@ files:
|
|
377
376
|
- spec/thinking_sphinx/source_spec.rb
|
378
377
|
- spec/thinking_sphinx/test_spec.rb
|
379
378
|
- spec/thinking_sphinx_spec.rb
|
380
|
-
has_rdoc: true
|
381
379
|
homepage: http://freelancing-god.github.com/ts/en/
|
382
380
|
licenses: []
|
383
381
|
|
@@ -410,7 +408,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
410
408
|
requirements: []
|
411
409
|
|
412
410
|
rubyforge_project: thinking-sphinx
|
413
|
-
rubygems_version: 1.
|
411
|
+
rubygems_version: 1.8.16
|
414
412
|
signing_key:
|
415
413
|
specification_version: 3
|
416
414
|
summary: ActiveRecord/Rails Sphinx library
|
@@ -538,3 +536,4 @@ test_files:
|
|
538
536
|
- spec/thinking_sphinx/source_spec.rb
|
539
537
|
- spec/thinking_sphinx/test_spec.rb
|
540
538
|
- spec/thinking_sphinx_spec.rb
|
539
|
+
has_rdoc:
|