thinking-sphinx 1.3.19 → 1.3.20

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.3.19
1
+ 1.3.20
@@ -14,6 +14,7 @@ class Alpha < ActiveRecord::Base
14
14
 
15
15
  has value, created_at, created_on
16
16
  has cost, :facet => true
17
+ has active
17
18
 
18
19
  set_property :field_weights => {'alternative_name' => 10}
19
20
 
@@ -10,6 +10,7 @@ require 'thinking_sphinx/property'
10
10
  require 'thinking_sphinx/active_record'
11
11
  require 'thinking_sphinx/association'
12
12
  require 'thinking_sphinx/attribute'
13
+ require 'thinking_sphinx/bundled_search'
13
14
  require 'thinking_sphinx/configuration'
14
15
  require 'thinking_sphinx/context'
15
16
  require 'thinking_sphinx/excerpter'
@@ -5,6 +5,8 @@ module ThinkingSphinx
5
5
  case version
6
6
  when '0.9.8', '0.9.9'
7
7
  require "riddle/#{version}"
8
+ when '1.10-beta'
9
+ require 'riddle/1.10'
8
10
  else
9
11
  STDERR.puts %Q{
10
12
  Sphinx cannot be found on your system. You may need to configure the following
@@ -0,0 +1,44 @@
1
+ module ThinkingSphinx
2
+ class BundledSearch
3
+ attr_reader :client
4
+
5
+ def initialize
6
+ @searches = []
7
+ end
8
+
9
+ def search(*args)
10
+ @searches << ThinkingSphinx.search(*args)
11
+ @searches.last.append_to client
12
+ end
13
+
14
+ def search_for_ids(*args)
15
+ @searches << ThinkingSphinx.search_for_ids(*args)
16
+ @searches.last.append_to client
17
+ end
18
+
19
+ def searches
20
+ populate
21
+ @searches
22
+ end
23
+
24
+ private
25
+
26
+ def client
27
+ @client ||= ThinkingSphinx::Configuration.instance.client
28
+ end
29
+
30
+ def populated?
31
+ @populated
32
+ end
33
+
34
+ def populate
35
+ return if populated?
36
+
37
+ @populated = true
38
+
39
+ client.run.each_with_index do |results, index|
40
+ searches[index].populate_from_queue results
41
+ end
42
+ end
43
+ end
44
+ end
@@ -57,20 +57,16 @@ module ThinkingSphinx
57
57
  ThinkingSphinx.facets *args
58
58
  end
59
59
 
60
- def self.bundle_searches(enum)
61
- client = ThinkingSphinx::Configuration.instance.client
60
+ def self.bundle_searches(enum = nil)
61
+ bundle = ThinkingSphinx::BundledSearch.new
62
62
 
63
- searches = enum.collect { |item|
64
- search = yield ThinkingSphinx, item
65
- search.append_to client
66
- search
67
- }
68
-
69
- client.run.each_with_index.collect { |results, index|
70
- searches[index].populate_from_queue results
71
- }
63
+ if enum.nil?
64
+ yield bundle
65
+ else
66
+ enum.each { |item| yield bundle, item }
67
+ end
72
68
 
73
- searches
69
+ bundle.searches
74
70
  end
75
71
 
76
72
  def self.matching_fields(fields, bitmask)
@@ -22,6 +22,14 @@ describe ThinkingSphinx::AutoVersion do
22
22
  ThinkingSphinx::AutoVersion.detect
23
23
  end
24
24
 
25
+ it "should require 1.10-beta if that is the detected version" do
26
+ ThinkingSphinx::AutoVersion.should_receive(:require).
27
+ with('riddle/1.10')
28
+
29
+ @config.stub!(:version => '1.10-beta')
30
+ ThinkingSphinx::AutoVersion.detect
31
+ end
32
+
25
33
  it "should output a warning if the detected version is something else" do
26
34
  STDERR.should_receive(:puts)
27
35
 
@@ -29,7 +29,7 @@ Jeweler::Tasks.new do |gem|
29
29
  "spec/**/*_spec.rb"
30
30
  ]
31
31
 
32
- gem.add_dependency 'activerecord', '>= 1.15.6'
32
+ gem.add_dependency 'activerecord', '>= 1.15.6', '< 3.0.0'
33
33
  gem.add_dependency 'riddle', '>= 1.0.10'
34
34
  gem.add_dependency 'after_commit', '>= 1.0.6'
35
35
 
data/tasks/testing.rb CHANGED
@@ -7,7 +7,7 @@ Spec::Rake::SpecTask.new do |t|
7
7
  t.spec_files = FileList['spec/**/*_spec.rb']
8
8
  t.spec_opts << "-c"
9
9
  end
10
- task :spec => :check_dependencies
10
+ # task :spec => :check_dependencies
11
11
 
12
12
  desc "Run all feature-set configurations"
13
13
  task :features do |t|
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thinking-sphinx
3
3
  version: !ruby/object:Gem::Version
4
- hash: 61
5
4
  prerelease: false
6
5
  segments:
7
6
  - 1
8
7
  - 3
9
- - 19
10
- version: 1.3.19
8
+ - 20
9
+ version: 1.3.20
11
10
  platform: ruby
12
11
  authors:
13
12
  - Pat Allan
@@ -15,7 +14,7 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2010-08-23 00:00:00 +08:00
17
+ date: 2010-09-03 00:00:00 +09:00
19
18
  default_executable:
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
@@ -26,12 +25,18 @@ dependencies:
26
25
  requirements:
27
26
  - - ">="
28
27
  - !ruby/object:Gem::Version
29
- hash: 39
30
28
  segments:
31
29
  - 1
32
30
  - 15
33
31
  - 6
34
32
  version: 1.15.6
33
+ - - <
34
+ - !ruby/object:Gem::Version
35
+ segments:
36
+ - 3
37
+ - 0
38
+ - 0
39
+ version: 3.0.0
35
40
  type: :runtime
36
41
  version_requirements: *id001
37
42
  - !ruby/object:Gem::Dependency
@@ -42,7 +47,6 @@ dependencies:
42
47
  requirements:
43
48
  - - ">="
44
49
  - !ruby/object:Gem::Version
45
- hash: 3
46
50
  segments:
47
51
  - 1
48
52
  - 0
@@ -58,7 +62,6 @@ dependencies:
58
62
  requirements:
59
63
  - - ">="
60
64
  - !ruby/object:Gem::Version
61
- hash: 27
62
65
  segments:
63
66
  - 1
64
67
  - 0
@@ -74,7 +77,6 @@ dependencies:
74
77
  requirements:
75
78
  - - ">="
76
79
  - !ruby/object:Gem::Version
77
- hash: 3
78
80
  segments:
79
81
  - 0
80
82
  version: "0"
@@ -88,7 +90,6 @@ dependencies:
88
90
  requirements:
89
91
  - - ">="
90
92
  - !ruby/object:Gem::Version
91
- hash: 13
92
93
  segments:
93
94
  - 1
94
95
  - 2
@@ -104,7 +105,6 @@ dependencies:
104
105
  requirements:
105
106
  - - ">="
106
107
  - !ruby/object:Gem::Version
107
- hash: 3
108
108
  segments:
109
109
  - 0
110
110
  version: "0"
@@ -118,7 +118,6 @@ dependencies:
118
118
  requirements:
119
119
  - - "="
120
120
  - !ruby/object:Gem::Version
121
- hash: 21
122
121
  segments:
123
122
  - 2
124
123
  - 3
@@ -134,7 +133,6 @@ dependencies:
134
133
  requirements:
135
134
  - - "="
136
135
  - !ruby/object:Gem::Version
137
- hash: 31
138
136
  segments:
139
137
  - 1
140
138
  - 2
@@ -150,7 +148,6 @@ dependencies:
150
148
  requirements:
151
149
  - - "="
152
150
  - !ruby/object:Gem::Version
153
- hash: 17
154
151
  segments:
155
152
  - 0
156
153
  - 3
@@ -185,6 +182,7 @@ files:
185
182
  - lib/thinking_sphinx/association.rb
186
183
  - lib/thinking_sphinx/attribute.rb
187
184
  - lib/thinking_sphinx/auto_version.rb
185
+ - lib/thinking_sphinx/bundled_search.rb
188
186
  - lib/thinking_sphinx/class_facet.rb
189
187
  - lib/thinking_sphinx/configuration.rb
190
188
  - lib/thinking_sphinx/context.rb
@@ -343,7 +341,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
343
341
  requirements:
344
342
  - - ">="
345
343
  - !ruby/object:Gem::Version
346
- hash: 3
347
344
  segments:
348
345
  - 0
349
346
  version: "0"
@@ -352,7 +349,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
352
349
  requirements:
353
350
  - - ">="
354
351
  - !ruby/object:Gem::Version
355
- hash: 3
356
352
  segments:
357
353
  - 0
358
354
  version: "0"