thinking-sphinx 2.0.10 → 2.0.11

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 CHANGED
@@ -1,3 +1,7 @@
1
+ 2.0.11 - January 2nd 2011
2
+ * Call #all on search results to force population of results, matching ActiveRecord::Relation#all in essence. (Adrian Macneil).
3
+ * 1.4.11 changes.
4
+
1
5
  2.0.10 - November 4th 2011
2
6
  * 1.4.10 changes.
3
7
 
@@ -53,6 +57,14 @@
53
57
  * Rails 3 support.
54
58
  * 1.4.0 changes.
55
59
 
60
+ 1.4.11 - January 2nd 2011
61
+ * Handle no results for total_pages and total_entries with defaults of 0.
62
+ * No longer shuffle Sphinx addresses by default.
63
+ * Fix coalescing of non-char values in PostgreSQL (Matthew Barnett).
64
+ * Default database user for Sphinx configuration is now ENV['USER'], not root.
65
+ * Alias offset to offset_value for Kaminari.
66
+ * Sphinx 2.1.0-dev support.
67
+
56
68
  1.4.10 - November 4th 2011
57
69
  * Updating Riddle references for impending 1.5.0 release of Riddle.
58
70
  * Handle out-of-date indexed_models references.
data/README.textile CHANGED
@@ -225,3 +225,5 @@ Since I first released this library, there's been quite a few people who have su
225
225
  * Eduardo Casanova
226
226
  * Tony Pitale
227
227
  * Kenn Ejima
228
+ * Matthew Barnett
229
+ * Adrian Macneil
@@ -14,7 +14,7 @@ module ThinkingSphinx
14
14
  clause.split('), ').join(") || '#{separator}' || ")
15
15
  else
16
16
  clause.split(', ').collect { |field|
17
- "CAST(COALESCE(#{field}, '') as varchar)"
17
+ "CAST(COALESCE(#{field}::varchar, '') as varchar)"
18
18
  }.join(" || '#{separator}' || ")
19
19
  end
20
20
  end
@@ -9,10 +9,12 @@ module ThinkingSphinx
9
9
  require 'riddle/1.10'
10
10
  when /2.0.\d/
11
11
  require 'riddle/2.0.1'
12
+ when /2.1.\d/
13
+ require 'riddle/2.1.0'
12
14
  else
13
15
  documentation_link = %Q{
14
16
  For more information, read the documentation:
15
- http://freelancing-god.github.com/ts/en/advanced_config.html
17
+ http://freelancing-god.github.com/ts/en/advanced_config.html
16
18
  }
17
19
 
18
20
  if version.nil? || version.empty?
@@ -110,7 +110,7 @@ module ThinkingSphinx
110
110
  self.model_directories = initial_model_directories
111
111
  self.delayed_job_priority = 0
112
112
  self.indexed_models = []
113
- self.shuffle = true
113
+ self.shuffle = false
114
114
 
115
115
  self.source_options = {}
116
116
  self.index_options = {
@@ -351,7 +351,7 @@ module ThinkingSphinx
351
351
  directories = ["#{app_root}/app/models/"] +
352
352
  Dir.glob("#{app_root}/vendor/plugins/*/app/models/")
353
353
 
354
- if defined?(Rails)
354
+ if defined?(Rails) && Rails.application
355
355
  directories += Rails.application.paths['app/models'].to_a
356
356
  directories += Rails.application.railties.engines.collect { |engine|
357
357
  engine.paths['app/models'].to_a
@@ -100,6 +100,12 @@ module ThinkingSphinx
100
100
  @array
101
101
  end
102
102
 
103
+ # Populates the search result set
104
+ def all
105
+ populate
106
+ self
107
+ end
108
+
103
109
  def freeze
104
110
  populate
105
111
  @array.freeze
@@ -224,7 +230,7 @@ module ThinkingSphinx
224
230
  def next_page?
225
231
  !next_page.nil?
226
232
  end
227
-
233
+
228
234
  def last_page?
229
235
  next_page.nil?
230
236
  end
@@ -263,7 +269,7 @@ module ThinkingSphinx
263
269
  #
264
270
  def total_pages
265
271
  populate
266
- return 0 if @results[:total].nil?
272
+ return 0 if @results.nil? || @results[:total].nil?
267
273
 
268
274
  @total_pages ||= (@results[:total] / per_page.to_f).ceil
269
275
  end
@@ -288,7 +294,7 @@ module ThinkingSphinx
288
294
  #
289
295
  def total_entries
290
296
  populate
291
- return 0 if @results[:total_found].nil?
297
+ return 0 if @results.nil? || @results[:total_found].nil?
292
298
 
293
299
  @total_entries ||= @results[:total_found]
294
300
  end
@@ -305,6 +311,8 @@ module ThinkingSphinx
305
311
  @options[:offset] || ((current_page - 1) * per_page)
306
312
  end
307
313
 
314
+ alias_method :offset_value, :offset
315
+
308
316
  def indexes
309
317
  return options[:index] if options[:index]
310
318
  return '*' if classes.empty?
@@ -5,11 +5,11 @@ module ThinkingSphinx
5
5
  class Source
6
6
  include ThinkingSphinx::Source::InternalProperties
7
7
  include ThinkingSphinx::Source::SQL
8
-
8
+
9
9
  attr_accessor :model, :fields, :attributes, :joins, :conditions, :groupings,
10
10
  :options
11
11
  attr_reader :base, :index, :database_configuration
12
-
12
+
13
13
  def initialize(index, options = {})
14
14
  @index = index
15
15
  @model = index.model
@@ -22,83 +22,83 @@ module ThinkingSphinx
22
22
  @associations = {}
23
23
  @database_configuration = @model.connection.
24
24
  instance_variable_get(:@config).clone
25
-
25
+
26
26
  @base = join_dependency_class.new(
27
27
  @model, [], initial_joins
28
28
  )
29
-
29
+
30
30
  unless @model.descends_from_active_record?
31
31
  stored_class = @model.store_full_sti_class ? @model.name : @model.name.demodulize
32
32
  @conditions << "#{@model.quoted_table_name}.#{quote_column(@model.inheritance_column)} = '#{stored_class}'"
33
33
  end
34
-
34
+
35
35
  add_internal_attributes_and_facets
36
36
  end
37
-
37
+
38
38
  def name
39
39
  index.name
40
40
  end
41
-
41
+
42
42
  def to_riddle_for_core(offset, position)
43
43
  source = Riddle::Configuration::SQLSource.new(
44
44
  "#{index.core_name}_#{position}", adapter.sphinx_identifier
45
45
  )
46
-
46
+
47
47
  set_source_database_settings source
48
48
  set_source_fields source
49
49
  set_source_attributes source, offset
50
50
  set_source_settings source
51
51
  set_source_sql source, offset
52
-
52
+
53
53
  source
54
54
  end
55
-
55
+
56
56
  def to_riddle_for_delta(offset, position)
57
57
  source = Riddle::Configuration::SQLSource.new(
58
58
  "#{index.delta_name}_#{position}", adapter.sphinx_identifier
59
59
  )
60
60
  source.parent = "#{index.core_name}_#{position}"
61
-
61
+
62
62
  set_source_database_settings source
63
63
  set_source_fields source
64
64
  set_source_attributes source, offset, true
65
65
  set_source_settings source
66
66
  set_source_sql source, offset, true
67
-
67
+
68
68
  source
69
69
  end
70
-
70
+
71
71
  def delta?
72
72
  !@index.delta_object.nil?
73
73
  end
74
-
74
+
75
75
  # Gets the association stack for a specific key.
76
- #
76
+ #
77
77
  def association(key)
78
78
  @associations[key] ||= Association.children(@model, key)
79
79
  end
80
-
80
+
81
81
  private
82
-
82
+
83
83
  def adapter
84
84
  @adapter ||= @model.sphinx_database_adapter
85
85
  end
86
-
86
+
87
87
  def available_attributes
88
88
  attributes.select { |attrib| attrib.available? }
89
89
  end
90
-
90
+
91
91
  def set_source_database_settings(source)
92
92
  config = @database_configuration
93
-
93
+
94
94
  source.sql_host = config[:host] || "localhost"
95
- source.sql_user = config[:username] || config[:user] || 'root'
95
+ source.sql_user = config[:username] || config[:user] || ENV['USER']
96
96
  source.sql_pass = (config[:password].to_s || "").gsub('#', '\#')
97
97
  source.sql_db = config[:database]
98
98
  source.sql_port = config[:port]
99
99
  source.sql_sock = config[:socket]
100
100
  end
101
-
101
+
102
102
  def set_source_fields(source)
103
103
  fields.each do |field|
104
104
  source.sql_file_field << field.unique_name if field.file?
@@ -106,34 +106,34 @@ module ThinkingSphinx
106
106
  source.sql_field_str2wordcount << field.unique_name if field.with_wordcount?
107
107
  end
108
108
  end
109
-
109
+
110
110
  def set_source_attributes(source, offset, delta = false)
111
111
  available_attributes.each do |attrib|
112
112
  source.send(attrib.type_to_config) << attrib.config_value(offset, delta)
113
113
  end
114
114
  end
115
-
115
+
116
116
  def set_source_sql(source, offset, delta = false)
117
117
  source.sql_query = to_sql(:offset => offset, :delta => delta).gsub(/\n/, ' ')
118
118
  source.sql_query_range = to_sql_query_range(:delta => delta)
119
119
  source.sql_query_info = to_sql_query_info(offset)
120
-
120
+
121
121
  source.sql_query_pre += send(!delta ? :sql_query_pre_for_core : :sql_query_pre_for_delta)
122
-
122
+
123
123
  if @index.local_options[:group_concat_max_len]
124
124
  source.sql_query_pre << "SET SESSION group_concat_max_len = #{@index.local_options[:group_concat_max_len]}"
125
125
  end
126
-
126
+
127
127
  source.sql_query_pre += [adapter.utf8_query_pre].compact if utf8?
128
128
  source.sql_query_pre << adapter.utc_query_pre
129
129
  end
130
-
130
+
131
131
  def set_source_settings(source)
132
132
  config = ThinkingSphinx::Configuration.instance
133
133
  config.source_options.each do |key, value|
134
134
  source.send("#{key}=".to_sym, value)
135
135
  end
136
-
136
+
137
137
  source_options = ThinkingSphinx::Configuration::SourceOptions
138
138
  @options.each do |key, value|
139
139
  if source_options.include?(key.to_s) && !value.nil?
@@ -141,11 +141,11 @@ module ThinkingSphinx
141
141
  end
142
142
  end
143
143
  end
144
-
144
+
145
145
  # Returns all associations used amongst all the fields and attributes.
146
146
  # This includes all associations between the model and what the actual
147
147
  # columns are from.
148
- #
148
+ #
149
149
  def all_associations
150
150
  @all_associations ||= (
151
151
  # field associations
@@ -165,11 +165,11 @@ module ThinkingSphinx
165
165
  assoc.ancestors
166
166
  }.flatten.uniq
167
167
  end
168
-
168
+
169
169
  def utf8?
170
170
  @index.options[:charset_type] =~ /utf-8|zh_cn.utf-8/
171
171
  end
172
-
172
+
173
173
  def join_dependency_class
174
174
  if rails_3_1?
175
175
  ::ActiveRecord::Associations::JoinDependency
@@ -177,7 +177,7 @@ module ThinkingSphinx
177
177
  ::ActiveRecord::Associations::ClassMethods::JoinDependency
178
178
  end
179
179
  end
180
-
180
+
181
181
  def initial_joins
182
182
  if rails_3_1?
183
183
  []
@@ -185,7 +185,7 @@ module ThinkingSphinx
185
185
  nil
186
186
  end
187
187
  end
188
-
188
+
189
189
  def rails_3_1?
190
190
  ::ActiveRecord::Associations.constants.include?(:JoinDependency) ||
191
191
  ::ActiveRecord::Associations.constants.include?('JoinDependency')
@@ -1,3 +1,3 @@
1
1
  module ThinkingSphinx
2
- Version = '2.0.10'
2
+ Version = '2.0.11'
3
3
  end
@@ -5,65 +5,73 @@ describe ThinkingSphinx::AutoVersion do
5
5
  before :each do
6
6
  @config = ThinkingSphinx::Configuration.instance
7
7
  end
8
-
8
+
9
9
  it "should require 0.9.8 if that is the detected version" do
10
10
  ThinkingSphinx::AutoVersion.should_receive(:require).
11
11
  with('riddle/0.9.8')
12
-
12
+
13
13
  @config.stub!(:version => '0.9.8')
14
14
  ThinkingSphinx::AutoVersion.detect
15
15
  end
16
-
16
+
17
17
  it "should require 0.9.9 if that is the detected version" do
18
18
  ThinkingSphinx::AutoVersion.should_receive(:require).
19
19
  with('riddle/0.9.9')
20
-
20
+
21
21
  @config.stub!(:version => '0.9.9')
22
22
  ThinkingSphinx::AutoVersion.detect
23
23
  end
24
-
24
+
25
25
  it "should require 1.10-beta if that is the detected version" do
26
26
  ThinkingSphinx::AutoVersion.should_receive(:require).
27
27
  with('riddle/1.10')
28
-
28
+
29
29
  @config.stub!(:version => '1.10-beta')
30
30
  ThinkingSphinx::AutoVersion.detect
31
31
  end
32
-
32
+
33
33
  it "should require 1.10-beta if using 1.10-beta compiled with id64 support" do
34
34
  ThinkingSphinx::AutoVersion.should_receive(:require).
35
35
  with('riddle/1.10')
36
-
36
+
37
37
  @config.stub!(:version => '1.10-id64-beta')
38
38
  ThinkingSphinx::AutoVersion.detect
39
39
  end
40
-
40
+
41
41
  it "should require 2.0.1 if using Sphinx 2.0.1 beta" do
42
42
  ThinkingSphinx::AutoVersion.should_receive(:require).
43
43
  with('riddle/2.0.1')
44
-
44
+
45
45
  @config.stub!(:version => '2.0.1-beta')
46
46
  ThinkingSphinx::AutoVersion.detect
47
47
  end
48
-
48
+
49
49
  it "should require 2.0.1 if using Sphinx 2.0.2 dev" do
50
50
  ThinkingSphinx::AutoVersion.should_receive(:require).
51
51
  with('riddle/2.0.1')
52
-
52
+
53
53
  @config.stub!(:version => '2.0.2-dev')
54
54
  ThinkingSphinx::AutoVersion.detect
55
55
  end
56
-
56
+
57
+ it "should require 2.1.0 if using Sphinx 2.1.0 dev" do
58
+ ThinkingSphinx::AutoVersion.should_receive(:require).
59
+ with('riddle/2.1.0')
60
+
61
+ @config.stub!(:version => '2.1.0-dev')
62
+ ThinkingSphinx::AutoVersion.detect
63
+ end
64
+
57
65
  it "should output a warning if the detected version is unsupported" do
58
66
  STDERR.should_receive(:puts).with(/unsupported/i)
59
-
67
+
60
68
  @config.stub!(:version => '0.9.7')
61
69
  ThinkingSphinx::AutoVersion.detect
62
70
  end
63
-
71
+
64
72
  it "should output a warning if the version cannot be determined" do
65
73
  STDERR.should_receive(:puts).at_least(:once)
66
-
74
+
67
75
  @config.stub!(:version => nil)
68
76
  ThinkingSphinx::AutoVersion.detect
69
77
  end
@@ -1346,6 +1346,21 @@ describe ThinkingSphinx::Search do
1346
1346
  end
1347
1347
  end
1348
1348
 
1349
+ describe '#all' do
1350
+ before :each do
1351
+ @search = ThinkingSphinx::Search.new
1352
+ end
1353
+
1354
+ it "should populate the result set" do
1355
+ @search.all
1356
+ @search.should be_populated
1357
+ end
1358
+
1359
+ it "should return the Search object" do
1360
+ @search.all.should be_a(ThinkingSphinx::Search)
1361
+ end
1362
+ end
1363
+
1349
1364
  describe '#freeze' do
1350
1365
  before :each do
1351
1366
  @search = ThinkingSphinx::Search.new
@@ -5,36 +5,36 @@ describe ThinkingSphinx::Source do
5
5
  @index = ThinkingSphinx::Index.new(Person)
6
6
  @source = ThinkingSphinx::Source.new(@index, :sql_range_step => 1000)
7
7
  end
8
-
8
+
9
9
  describe '#initialize' do
10
10
  it "should store the current connection details" do
11
11
  config = Person.connection.instance_variable_get(:@config)
12
12
  @source.database_configuration.should == config
13
13
  end
14
14
  end
15
-
15
+
16
16
  it "should generate the name from the model" do
17
17
  @source.name.should == "person"
18
18
  end
19
-
19
+
20
20
  it "should handle namespaced models for name generation" do
21
21
  index = ThinkingSphinx::Index.new(Admin::Person)
22
22
  source = ThinkingSphinx::Source.new(index)
23
23
  source.name.should == "admin_person"
24
24
  end
25
-
25
+
26
26
  describe "#to_riddle_for_core" do
27
27
  before :each do
28
28
  config = ThinkingSphinx::Configuration.instance
29
29
  config.source_options[:sql_ranged_throttle] = 100
30
-
30
+
31
31
  ThinkingSphinx::Field.new(
32
32
  @source, ThinkingSphinx::Index::FauxColumn.new(:first_name)
33
33
  )
34
34
  ThinkingSphinx::Field.new(
35
35
  @source, ThinkingSphinx::Index::FauxColumn.new(:last_name)
36
36
  )
37
-
37
+
38
38
  ThinkingSphinx::Attribute.new(
39
39
  @source, ThinkingSphinx::Index::FauxColumn.new(:id), :as => :internal_id
40
40
  )
@@ -52,31 +52,31 @@ describe ThinkingSphinx::Source do
52
52
  @source, ThinkingSphinx::Index::FauxColumn.new(:source, :id),
53
53
  :as => :source_id, :type => :integer
54
54
  )
55
-
55
+
56
56
  ThinkingSphinx::Join.new(
57
57
  @source, ThinkingSphinx::Index::FauxColumn.new(:links)
58
58
  )
59
-
59
+
60
60
  @source.conditions << "`birthday` <= NOW()"
61
61
  @source.groupings << "`first_name`"
62
-
62
+
63
63
  @index.local_options[:group_concat_max_len] = 1024
64
-
64
+
65
65
  @riddle = @source.to_riddle_for_core(1, 0)
66
66
  end
67
-
67
+
68
68
  it "should generate a Riddle Source object" do
69
69
  @riddle.should be_a_kind_of(Riddle::Configuration::SQLSource)
70
70
  end
71
-
71
+
72
72
  it "should use the index and name its own name" do
73
73
  @riddle.name.should == "person_core_0"
74
74
  end
75
-
75
+
76
76
  it "should use the model's database connection to determine type" do
77
77
  @riddle.type.should == "mysql"
78
78
  end
79
-
79
+
80
80
  it "should match the model's database settings" do
81
81
  config = Person.connection.instance_variable_get(:@config)
82
82
  @riddle.sql_db.should == config[:database]
@@ -86,123 +86,123 @@ describe ThinkingSphinx::Source do
86
86
  @riddle.sql_port.should == config[:port]
87
87
  @riddle.sql_sock.should == config[:socket]
88
88
  end
89
-
90
- it "should use a default username of root if nothing else is provided" do
89
+
90
+ it "should use a environment user if nothing else is provided" do
91
91
  Person.connection.stub!(:instance_variable_get => {
92
92
  :user => nil,
93
93
  :username => nil
94
94
  })
95
95
  @source = ThinkingSphinx::Source.new(@index)
96
-
96
+
97
97
  riddle = @source.to_riddle_for_core(1, 0)
98
- riddle.sql_user.should == 'root'
98
+ riddle.sql_user.should == ENV['USER']
99
99
  end
100
-
100
+
101
101
  it "should assign attributes" do
102
102
  # 3 internal attributes plus the one requested
103
103
  @riddle.sql_attr_uint.length.should == 4
104
104
  @riddle.sql_attr_uint.last.should == :internal_id
105
-
105
+
106
106
  @riddle.sql_attr_timestamp.length.should == 1
107
107
  @riddle.sql_attr_timestamp.first.should == :birthday
108
108
  end
109
-
109
+
110
110
  it "should not include an attribute definition for polymorphic references without data" do
111
111
  @riddle.sql_attr_uint.select { |uint|
112
112
  uint == :source_id
113
113
  }.should be_empty
114
114
  end
115
-
115
+
116
116
  it "should set Sphinx Source options" do
117
117
  @riddle.sql_range_step.should == 1000
118
118
  @riddle.sql_ranged_throttle.should == 100
119
119
  end
120
-
120
+
121
121
  describe "#sql_query" do
122
122
  before :each do
123
123
  @query = @riddle.sql_query
124
124
  end
125
-
125
+
126
126
  it "should select data from the model table" do
127
127
  @query.should match(/FROM\s+`people`/)
128
128
  end
129
-
129
+
130
130
  it "should select each of the fields" do
131
131
  @query.should match(/`first_name`.+FROM/)
132
132
  @query.should match(/`last_name`.+FROM/)
133
133
  end
134
-
134
+
135
135
  it "should select each of the attributes" do
136
136
  @query.should match(/`id` AS `internal_id`.+FROM/)
137
137
  @query.should match(/`birthday`.+FROM/)
138
138
  @query.should match(/`tags`.`id`.+ AS `tag_ids`.+FROM/)
139
139
  end
140
-
140
+
141
141
  it "should not match the sourced MVA attribute" do
142
142
  @query.should_not match(/contact_ids/)
143
143
  end
144
-
144
+
145
145
  it "should include joins for required associations" do
146
146
  @query.should match(/LEFT OUTER JOIN `tags`/)
147
147
  end
148
-
148
+
149
149
  it "should not include joins for the sourced MVA attribute" do
150
150
  @query.should_not match(/LEFT OUTER JOIN `contacts`/)
151
151
  end
152
-
152
+
153
153
  it "should include explicitly requested joins" do
154
154
  @query.should match(/LEFT OUTER JOIN `links`/)
155
155
  end
156
-
156
+
157
157
  it "should include any defined conditions" do
158
158
  @query.should match(/WHERE.+`birthday` <= NOW()/)
159
159
  end
160
-
160
+
161
161
  it "should include any defined groupings" do
162
162
  @query.should match(/GROUP BY.+`first_name`/)
163
163
  end
164
164
  end
165
-
165
+
166
166
  describe "#sql_query_range" do
167
167
  before :each do
168
168
  @query = @riddle.sql_query_range
169
169
  end
170
-
170
+
171
171
  it "should select data from the model table" do
172
172
  @query.should match(/FROM `people`/)
173
173
  end
174
-
174
+
175
175
  it "should select the minimum and the maximum ids" do
176
176
  @query.should match(/SELECT.+MIN.+MAX.+FROM/)
177
177
  end
178
178
  end
179
-
179
+
180
180
  describe "#sql_query_info" do
181
181
  before :each do
182
182
  @query = @riddle.sql_query_info
183
183
  end
184
-
184
+
185
185
  it "should select all fields from the model table" do
186
186
  @query.should match(/SELECT \* FROM `people`/)
187
187
  end
188
-
188
+
189
189
  it "should filter the primary key with the offset" do
190
190
  model_count = ThinkingSphinx.context.indexed_models.size
191
191
  @query.should match(/WHERE `id` = \(\(\$id - 1\) \/ #{model_count}\)/)
192
192
  end
193
193
  end
194
-
194
+
195
195
  describe "#sql_query_pre" do
196
196
  before :each do
197
197
  @queries = @riddle.sql_query_pre
198
198
  end
199
-
199
+
200
200
  it "should default to just the UTF8 statement" do
201
201
  @queries.detect { |query|
202
202
  query == "SET NAMES utf8"
203
203
  }.should_not be_nil
204
204
  end
205
-
205
+
206
206
  it "should set the group_concat_max_len session value for MySQL if requested" do
207
207
  @queries.detect { |query|
208
208
  query == "SET SESSION group_concat_max_len = 1024"
@@ -210,41 +210,41 @@ describe ThinkingSphinx::Source do
210
210
  end
211
211
  end
212
212
  end
213
-
213
+
214
214
  describe "#to_riddle_for_core with range disabled" do
215
215
  before :each do
216
216
  ThinkingSphinx::Field.new(
217
217
  @source, ThinkingSphinx::Index::FauxColumn.new(:first_name)
218
218
  )
219
219
  end
220
-
220
+
221
221
  describe "set per-index" do
222
222
  before :each do
223
223
  @index.local_options[:disable_range] = true
224
224
  @riddle = @source.to_riddle_for_core(1, 0)
225
225
  end
226
-
226
+
227
227
  it "should not have the range in the sql_query" do
228
228
  @riddle.sql_query.should_not match(/`people`.`id` >= \$start/)
229
229
  @riddle.sql_query.should_not match(/`people`.`id` <= \$end/)
230
230
  end
231
-
231
+
232
232
  it "should not have a sql_query_range" do
233
233
  @riddle.sql_query_range.should be_nil
234
234
  end
235
235
  end
236
-
236
+
237
237
  describe "set globally" do
238
238
  before :each do
239
239
  ThinkingSphinx::Configuration.instance.index_options[:disable_range] = true
240
240
  @riddle = @source.to_riddle_for_core(1, 0)
241
241
  end
242
-
242
+
243
243
  it "should not have the range in the sql_query" do
244
244
  @riddle.sql_query.should_not match(/`people`.`id` >= \$start/)
245
245
  @riddle.sql_query.should_not match(/`people`.`id` <= \$end/)
246
246
  end
247
-
247
+
248
248
  it "should not have a sql_query_range" do
249
249
  @riddle.sql_query_range.should be_nil
250
250
  end
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: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 2
8
8
  - 0
9
- - 10
10
- version: 2.0.10
9
+ - 11
10
+ version: 2.0.11
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: 2011-11-04 00:00:00 +02:00
18
+ date: 2012-01-02 00:00:00 +11:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency