dpickett-thinking-sphinx 1.1.12 → 1.1.23

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. data/README.textile +19 -0
  2. data/lib/thinking_sphinx.rb +36 -2
  3. data/lib/thinking_sphinx/active_record.rb +18 -3
  4. data/lib/thinking_sphinx/adapters/postgresql_adapter.rb +9 -3
  5. data/lib/thinking_sphinx/association.rb +4 -1
  6. data/lib/thinking_sphinx/attribute.rb +85 -43
  7. data/lib/thinking_sphinx/configuration.rb +33 -12
  8. data/lib/thinking_sphinx/deltas.rb +9 -6
  9. data/lib/thinking_sphinx/deltas/datetime_delta.rb +3 -3
  10. data/lib/thinking_sphinx/deltas/default_delta.rb +4 -4
  11. data/lib/thinking_sphinx/deltas/delayed_delta/delta_job.rb +1 -1
  12. data/lib/thinking_sphinx/deploy/capistrano.rb +82 -64
  13. data/lib/thinking_sphinx/facet.rb +58 -21
  14. data/lib/thinking_sphinx/facet_collection.rb +12 -13
  15. data/lib/thinking_sphinx/field.rb +3 -1
  16. data/lib/thinking_sphinx/index.rb +28 -353
  17. data/lib/thinking_sphinx/index/builder.rb +255 -232
  18. data/lib/thinking_sphinx/property.rb +29 -2
  19. data/lib/thinking_sphinx/search.rb +32 -96
  20. data/lib/thinking_sphinx/search/facets.rb +104 -0
  21. data/lib/thinking_sphinx/source.rb +150 -0
  22. data/lib/thinking_sphinx/source/internal_properties.rb +46 -0
  23. data/lib/thinking_sphinx/source/sql.rb +128 -0
  24. data/lib/thinking_sphinx/tasks.rb +42 -8
  25. data/rails/init.rb +14 -0
  26. data/spec/unit/thinking_sphinx/active_record/delta_spec.rb +5 -5
  27. data/spec/unit/thinking_sphinx/active_record/search_spec.rb +4 -4
  28. data/spec/unit/thinking_sphinx/active_record_spec.rb +52 -39
  29. data/spec/unit/thinking_sphinx/association_spec.rb +4 -5
  30. data/spec/unit/thinking_sphinx/attribute_spec.rb +209 -19
  31. data/spec/unit/thinking_sphinx/collection_spec.rb +7 -6
  32. data/spec/unit/thinking_sphinx/configuration_spec.rb +93 -7
  33. data/spec/unit/thinking_sphinx/facet_spec.rb +256 -0
  34. data/spec/unit/thinking_sphinx/field_spec.rb +26 -17
  35. data/spec/unit/thinking_sphinx/index/builder_spec.rb +351 -1
  36. data/spec/unit/thinking_sphinx/index_spec.rb +3 -102
  37. data/spec/unit/thinking_sphinx/rails_additions_spec.rb +13 -5
  38. data/spec/unit/thinking_sphinx/search_spec.rb +154 -29
  39. data/spec/unit/thinking_sphinx/source_spec.rb +217 -0
  40. data/spec/unit/thinking_sphinx_spec.rb +22 -4
  41. data/tasks/distribution.rb +19 -0
  42. data/vendor/riddle/lib/riddle.rb +1 -1
  43. data/vendor/riddle/lib/riddle/configuration/section.rb +7 -1
  44. metadata +26 -3
@@ -51,6 +51,22 @@ describe ThinkingSphinx do
51
51
  ThinkingSphinx.updates_enabled?.should be_true
52
52
  end
53
53
 
54
+ it "should always say Sphinx is running if flagged as being on a remote machine" do
55
+ ThinkingSphinx.remote_sphinx = true
56
+ ThinkingSphinx.stub_method(:sphinx_running_by_pid? => false)
57
+
58
+ ThinkingSphinx.sphinx_running?.should be_true
59
+ end
60
+
61
+ it "should actually pay attention to Sphinx if not on a remote machine" do
62
+ ThinkingSphinx.remote_sphinx = false
63
+ ThinkingSphinx.stub_method(:sphinx_running_by_pid? => false)
64
+ ThinkingSphinx.sphinx_running?.should be_false
65
+
66
+ ThinkingSphinx.stub_method(:sphinx_running_by_pid? => true)
67
+ ThinkingSphinx.sphinx_running?.should be_true
68
+ end
69
+
54
70
  describe "use_group_by_shortcut? method" do
55
71
  before :each do
56
72
  adapter = defined?(JRUBY_VERSION) ? :JdbcAdapter : :MysqlAdapter
@@ -105,12 +121,14 @@ describe ThinkingSphinx do
105
121
 
106
122
  describe "if not using MySQL" do
107
123
  before :each do
108
- adapter = defined?(JRUBY_VERSION) ? :JdbcAdapter : :PostgreSQLAdapter
124
+ adapter = defined?(JRUBY_VERSION) ? 'JdbcAdapter' : 'PostgreSQLAdapter'
109
125
  unless ::ActiveRecord::ConnectionAdapters.const_defined?(adapter)
110
126
  pending "No PostgreSQL"
111
127
  return
112
128
  end
113
- @connection = ::ActiveRecord::ConnectionAdapters.const_get(adapter).stub_instance(
129
+
130
+ @connection = stub(adapter).as_null_object
131
+ @connection.stub!(
114
132
  :select_all => true,
115
133
  :config => {:adapter => defined?(JRUBY_VERSION) ? 'jdbcpostgresql' : 'postgresql'}
116
134
  )
@@ -124,9 +142,9 @@ describe ThinkingSphinx do
124
142
  end
125
143
 
126
144
  it "should not call select_all" do
127
- ThinkingSphinx.use_group_by_shortcut?
145
+ @connection.should_not_receive(:select_all)
128
146
 
129
- @connection.should_not have_received(:select_all)
147
+ ThinkingSphinx.use_group_by_shortcut?
130
148
  end
131
149
  end
132
150
  end
@@ -27,6 +27,7 @@ spec = Gem::Specification.new do |s|
27
27
  s.rubyforge_project = "thinking-sphinx"
28
28
  s.test_files = FileList["spec/**/*_spec.rb"]
29
29
  s.files = FileList[
30
+ "rails/*.rb",
30
31
  "lib/**/*.rb",
31
32
  "LICENCE",
32
33
  "README.textile",
@@ -34,6 +35,24 @@ spec = Gem::Specification.new do |s|
34
35
  "tasks/**/*.rake",
35
36
  "vendor/**/*"
36
37
  ]
38
+ s.post_install_message = <<-MESSAGE
39
+ With the release of Thinking Sphinx 1.1.18, there is one important change to
40
+ note: previously, the default morphology for indexing was 'stem_en'. The new
41
+ default is nil, to avoid any unexpected behavior. If you wish to keep the old
42
+ value though, you will need to add the following settings to your
43
+ config/sphinx.yml file:
44
+
45
+ development:
46
+ morphology: stem_en
47
+ test:
48
+ morphology: stem_en
49
+ production:
50
+ morphology: stem_en
51
+
52
+ To understand morphologies/stemmers better, visit the following link:
53
+ http://www.sphinxsearch.com/docs/manual-0.9.8.html#conf-morphology
54
+
55
+ MESSAGE
37
56
  end
38
57
 
39
58
  Rake::GemPackageTask.new(spec) do |p|
@@ -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 = 4
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
- value.is_a?(Array) ? value : [value]
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: dpickett-thinking-sphinx
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.12
4
+ version: 1.1.23
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-11 00:00:00 -07:00
12
+ date: 2009-06-28 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -22,6 +22,7 @@ extensions: []
22
22
  extra_rdoc_files: []
23
23
 
24
24
  files:
25
+ - rails/init.rb
25
26
  - lib/thinking_sphinx/active_record/attribute_updates.rb
26
27
  - lib/thinking_sphinx/active_record/delta.rb
27
28
  - lib/thinking_sphinx/active_record/has_many_association.rb
@@ -52,7 +53,11 @@ files:
52
53
  - lib/thinking_sphinx/index.rb
53
54
  - lib/thinking_sphinx/property.rb
54
55
  - lib/thinking_sphinx/rails_additions.rb
56
+ - lib/thinking_sphinx/search/facets.rb
55
57
  - lib/thinking_sphinx/search.rb
58
+ - lib/thinking_sphinx/source/internal_properties.rb
59
+ - lib/thinking_sphinx/source/sql.rb
60
+ - lib/thinking_sphinx/source.rb
56
61
  - lib/thinking_sphinx/tasks.rb
57
62
  - lib/thinking_sphinx.rb
58
63
  - LICENCE
@@ -117,10 +122,27 @@ files:
117
122
  - spec/unit/thinking_sphinx/index_spec.rb
118
123
  - spec/unit/thinking_sphinx/rails_additions_spec.rb
119
124
  - spec/unit/thinking_sphinx/search_spec.rb
125
+ - spec/unit/thinking_sphinx/source_spec.rb
120
126
  - spec/unit/thinking_sphinx_spec.rb
121
127
  has_rdoc: true
122
128
  homepage: http://ts.freelancing-gods.com
123
- post_install_message:
129
+ post_install_message: |+
130
+ With the release of Thinking Sphinx 1.1.18, there is one important change to
131
+ note: previously, the default morphology for indexing was 'stem_en'. The new
132
+ default is nil, to avoid any unexpected behavior. If you wish to keep the old
133
+ value though, you will need to add the following settings to your
134
+ config/sphinx.yml file:
135
+
136
+ development:
137
+ morphology: stem_en
138
+ test:
139
+ morphology: stem_en
140
+ production:
141
+ morphology: stem_en
142
+
143
+ To understand morphologies/stemmers better, visit the following link:
144
+ http://www.sphinxsearch.com/docs/manual-0.9.8.html#conf-morphology
145
+
124
146
  rdoc_options:
125
147
  - --title
126
148
  - Thinking Sphinx -- Rails/Merb Sphinx Plugin
@@ -164,4 +186,5 @@ test_files:
164
186
  - spec/unit/thinking_sphinx/index_spec.rb
165
187
  - spec/unit/thinking_sphinx/rails_additions_spec.rb
166
188
  - spec/unit/thinking_sphinx/search_spec.rb
189
+ - spec/unit/thinking_sphinx/source_spec.rb
167
190
  - spec/unit/thinking_sphinx_spec.rb