sunspot 2.1.1 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. data/lib/sunspot.rb +13 -9
  2. data/lib/sunspot/dsl.rb +4 -3
  3. data/lib/sunspot/dsl/fields.rb +11 -16
  4. data/lib/sunspot/dsl/paginatable.rb +4 -1
  5. data/lib/sunspot/dsl/spellcheckable.rb +14 -0
  6. data/lib/sunspot/dsl/standard_query.rb +63 -35
  7. data/lib/sunspot/field.rb +54 -8
  8. data/lib/sunspot/field_factory.rb +2 -4
  9. data/lib/sunspot/indexer.rb +1 -2
  10. data/lib/sunspot/query.rb +2 -2
  11. data/lib/sunspot/query/abstract_fulltext.rb +69 -0
  12. data/lib/sunspot/query/common_query.rb +13 -2
  13. data/lib/sunspot/query/composite_fulltext.rb +58 -8
  14. data/lib/sunspot/query/dismax.rb +14 -67
  15. data/lib/sunspot/query/function_query.rb +1 -2
  16. data/lib/sunspot/query/geo.rb +1 -1
  17. data/lib/sunspot/query/join.rb +90 -0
  18. data/lib/sunspot/query/pagination.rb +12 -4
  19. data/lib/sunspot/query/restriction.rb +3 -4
  20. data/lib/sunspot/query/sort.rb +6 -0
  21. data/lib/sunspot/query/sort_composite.rb +7 -0
  22. data/lib/sunspot/query/spellcheck.rb +19 -0
  23. data/lib/sunspot/query/standard_query.rb +24 -2
  24. data/lib/sunspot/query/text_field_boost.rb +1 -3
  25. data/lib/sunspot/search/abstract_search.rb +10 -1
  26. data/lib/sunspot/search/cursor_paginated_collection.rb +32 -0
  27. data/lib/sunspot/search/paginated_collection.rb +1 -0
  28. data/lib/sunspot/search/standard_search.rb +71 -3
  29. data/lib/sunspot/session.rb +6 -6
  30. data/lib/sunspot/setup.rb +6 -1
  31. data/lib/sunspot/util.rb +46 -13
  32. data/lib/sunspot/version.rb +1 -1
  33. data/spec/api/query/fulltext_examples.rb +150 -1
  34. data/spec/api/query/geo_examples.rb +2 -6
  35. data/spec/api/query/join_spec.rb +3 -3
  36. data/spec/api/query/ordering_pagination_examples.rb +14 -0
  37. data/spec/api/query/spellcheck_examples.rb +20 -0
  38. data/spec/api/query/standard_spec.rb +1 -0
  39. data/spec/api/search/cursor_paginated_collection_spec.rb +35 -0
  40. data/spec/api/search/paginated_collection_spec.rb +1 -0
  41. data/spec/api/session_spec.rb +36 -2
  42. data/spec/integration/spellcheck_spec.rb +74 -0
  43. data/spec/mocks/connection.rb +5 -3
  44. data/spec/mocks/photo.rb +12 -4
  45. data/spec/spec_helper.rb +4 -0
  46. metadata +24 -5
  47. checksums.yaml +0 -7
@@ -1,9 +1,10 @@
1
1
  class Photo < MockRecord
2
- attr_accessor :caption, :lat, :lng, :size, :average_rating, :created_at, :post_id, :photo_container_id
2
+ attr_accessor :caption, :description, :lat, :lng, :size, :average_rating, :created_at, :post_id, :photo_container_id
3
3
  end
4
4
 
5
5
  Sunspot.setup(Photo) do
6
6
  text :caption, :default_boost => 1.5
7
+ text :description
7
8
  string :caption
8
9
  integer :photo_container_id
9
10
  boost 0.75
@@ -13,12 +14,19 @@ Sunspot.setup(Photo) do
13
14
  end
14
15
 
15
16
  class PhotoContainer < MockRecord
17
+ attr_accessor :description
18
+
16
19
  def id
17
20
  1
18
21
  end
19
22
  end
20
23
 
21
24
  Sunspot.setup(PhotoContainer) do
22
- join(:caption, :type => :string, :join_string => 'from=photo_container_id to=id')
23
- join(:photo_rating, :type => :trie_float, :join_string => 'from=photo_container_id to=id', :as => 'average_rating_ft')
24
- end
25
+ integer :id
26
+ text :description, :default_boost => 1.2
27
+
28
+ join(:caption, :target => Photo, :type => :string, :join => { :from => :photo_container_id, :to => :id })
29
+ join(:photo_rating, :target => Photo, :type => :trie_float, :join => { :from => :photo_container_id, :to => :id }, :as => 'average_rating_ft')
30
+ join(:caption, :target => Photo, :type => :text, :join => { :from => :photo_container_id, :to => :id })
31
+ join(:description, :prefix => "photo", :target => Photo, :type => :text, :join => { :from => :photo_container_id, :to => :id })
32
+ end
@@ -13,6 +13,10 @@ end
13
13
  require File.join(File.dirname(__FILE__), 'ext')
14
14
 
15
15
  RSpec.configure do |config|
16
+ # Run only examples with :focus => true
17
+ config.filter_run :focus => true
18
+ config.run_all_when_everything_filtered = true
19
+
16
20
  # Mock session available to all spec/api tests
17
21
  config.include MockSessionHelper,
18
22
  :type => :api,
metadata CHANGED
@@ -1,7 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sunspot
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.2.0
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Mat Brown
@@ -28,11 +29,12 @@ authors:
28
29
  autorequire:
29
30
  bindir: bin
30
31
  cert_chain: []
31
- date: 2014-05-07 00:00:00.000000000 Z
32
+ date: 2015-04-09 00:00:00.000000000 Z
32
33
  dependencies:
33
34
  - !ruby/object:Gem::Dependency
34
35
  name: rsolr
35
36
  requirement: !ruby/object:Gem::Requirement
37
+ none: false
36
38
  requirements:
37
39
  - - "~>"
38
40
  - !ruby/object:Gem::Version
@@ -40,6 +42,7 @@ dependencies:
40
42
  type: :runtime
41
43
  prerelease: false
42
44
  version_requirements: !ruby/object:Gem::Requirement
45
+ none: false
43
46
  requirements:
44
47
  - - "~>"
45
48
  - !ruby/object:Gem::Version
@@ -47,6 +50,7 @@ dependencies:
47
50
  - !ruby/object:Gem::Dependency
48
51
  name: pr_geohash
49
52
  requirement: !ruby/object:Gem::Requirement
53
+ none: false
50
54
  requirements:
51
55
  - - "~>"
52
56
  - !ruby/object:Gem::Version
@@ -54,6 +58,7 @@ dependencies:
54
58
  type: :runtime
55
59
  prerelease: false
56
60
  version_requirements: !ruby/object:Gem::Requirement
61
+ none: false
57
62
  requirements:
58
63
  - - "~>"
59
64
  - !ruby/object:Gem::Version
@@ -61,6 +66,7 @@ dependencies:
61
66
  - !ruby/object:Gem::Dependency
62
67
  name: rspec
63
68
  requirement: !ruby/object:Gem::Requirement
69
+ none: false
64
70
  requirements:
65
71
  - - "~>"
66
72
  - !ruby/object:Gem::Version
@@ -68,6 +74,7 @@ dependencies:
68
74
  type: :development
69
75
  prerelease: false
70
76
  version_requirements: !ruby/object:Gem::Requirement
77
+ none: false
71
78
  requirements:
72
79
  - - "~>"
73
80
  - !ruby/object:Gem::Version
@@ -112,12 +119,14 @@ files:
112
119
  - lib/sunspot/dsl/restriction_with_near.rb
113
120
  - lib/sunspot/dsl/scope.rb
114
121
  - lib/sunspot/dsl/search.rb
122
+ - lib/sunspot/dsl/spellcheckable.rb
115
123
  - lib/sunspot/dsl/standard_query.rb
116
124
  - lib/sunspot/field.rb
117
125
  - lib/sunspot/field_factory.rb
118
126
  - lib/sunspot/indexer.rb
119
127
  - lib/sunspot/query.rb
120
128
  - lib/sunspot/query/abstract_field_facet.rb
129
+ - lib/sunspot/query/abstract_fulltext.rb
121
130
  - lib/sunspot/query/bbox.rb
122
131
  - lib/sunspot/query/boost_query.rb
123
132
  - lib/sunspot/query/common_query.rb
@@ -133,6 +142,7 @@ files:
133
142
  - lib/sunspot/query/geo.rb
134
143
  - lib/sunspot/query/geofilt.rb
135
144
  - lib/sunspot/query/highlighting.rb
145
+ - lib/sunspot/query/join.rb
136
146
  - lib/sunspot/query/more_like_this.rb
137
147
  - lib/sunspot/query/more_like_this_query.rb
138
148
  - lib/sunspot/query/pagination.rb
@@ -142,11 +152,13 @@ files:
142
152
  - lib/sunspot/query/scope.rb
143
153
  - lib/sunspot/query/sort.rb
144
154
  - lib/sunspot/query/sort_composite.rb
155
+ - lib/sunspot/query/spellcheck.rb
145
156
  - lib/sunspot/query/standard_query.rb
146
157
  - lib/sunspot/query/text_field_boost.rb
147
158
  - lib/sunspot/schema.rb
148
159
  - lib/sunspot/search.rb
149
160
  - lib/sunspot/search/abstract_search.rb
161
+ - lib/sunspot/search/cursor_paginated_collection.rb
150
162
  - lib/sunspot/search/date_facet.rb
151
163
  - lib/sunspot/search/facet_row.rb
152
164
  - lib/sunspot/search/field_facet.rb
@@ -210,10 +222,12 @@ files:
210
222
  - spec/api/query/scope_examples.rb
211
223
  - spec/api/query/spatial_examples.rb
212
224
  - spec/api/query/spec_helper.rb
225
+ - spec/api/query/spellcheck_examples.rb
213
226
  - spec/api/query/standard_spec.rb
214
227
  - spec/api/query/stats_examples.rb
215
228
  - spec/api/query/text_field_scoping_examples.rb
216
229
  - spec/api/query/types_spec.rb
230
+ - spec/api/search/cursor_paginated_collection_spec.rb
217
231
  - spec/api/search/dynamic_fields_spec.rb
218
232
  - spec/api/search/faceting_spec.rb
219
233
  - spec/api/search/highlighting_spec.rb
@@ -250,6 +264,7 @@ files:
250
264
  - spec/integration/local_search_spec.rb
251
265
  - spec/integration/more_like_this_spec.rb
252
266
  - spec/integration/scoped_search_spec.rb
267
+ - spec/integration/spellcheck_spec.rb
253
268
  - spec/integration/stats_spec.rb
254
269
  - spec/integration/stored_fields_spec.rb
255
270
  - spec/integration/test_pagination.rb
@@ -274,7 +289,6 @@ files:
274
289
  homepage: http://outoftime.github.com/sunspot
275
290
  licenses:
276
291
  - MIT
277
- metadata: {}
278
292
  post_install_message:
279
293
  rdoc_options:
280
294
  - "--webcvs=http://github.com/outoftime/sunspot/tree/master/%s"
@@ -285,20 +299,22 @@ rdoc_options:
285
299
  require_paths:
286
300
  - lib
287
301
  required_ruby_version: !ruby/object:Gem::Requirement
302
+ none: false
288
303
  requirements:
289
304
  - - ">="
290
305
  - !ruby/object:Gem::Version
291
306
  version: '0'
292
307
  required_rubygems_version: !ruby/object:Gem::Requirement
308
+ none: false
293
309
  requirements:
294
310
  - - ">="
295
311
  - !ruby/object:Gem::Version
296
312
  version: '0'
297
313
  requirements: []
298
314
  rubyforge_project: sunspot
299
- rubygems_version: 2.2.2
315
+ rubygems_version: 1.8.25
300
316
  signing_key:
301
- specification_version: 4
317
+ specification_version: 3
302
318
  summary: Library for expressive, powerful interaction with the Solr search engine
303
319
  test_files:
304
320
  - spec/api/adapters_spec.rb
@@ -330,10 +346,12 @@ test_files:
330
346
  - spec/api/query/scope_examples.rb
331
347
  - spec/api/query/spatial_examples.rb
332
348
  - spec/api/query/spec_helper.rb
349
+ - spec/api/query/spellcheck_examples.rb
333
350
  - spec/api/query/standard_spec.rb
334
351
  - spec/api/query/stats_examples.rb
335
352
  - spec/api/query/text_field_scoping_examples.rb
336
353
  - spec/api/query/types_spec.rb
354
+ - spec/api/search/cursor_paginated_collection_spec.rb
337
355
  - spec/api/search/dynamic_fields_spec.rb
338
356
  - spec/api/search/faceting_spec.rb
339
357
  - spec/api/search/highlighting_spec.rb
@@ -370,6 +388,7 @@ test_files:
370
388
  - spec/integration/local_search_spec.rb
371
389
  - spec/integration/more_like_this_spec.rb
372
390
  - spec/integration/scoped_search_spec.rb
391
+ - spec/integration/spellcheck_spec.rb
373
392
  - spec/integration/stats_spec.rb
374
393
  - spec/integration/stored_fields_spec.rb
375
394
  - spec/integration/test_pagination.rb
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 7e84a7b3df6b149b54fbea2bb14a67cd561cbb71
4
- data.tar.gz: 61c35909935859b351c2608362e733aceaf65394
5
- SHA512:
6
- metadata.gz: 23311e3c435b010699df2bbb6c6fe634ad64178d0a02637d9bdc500e4d5814678d6cfb45c83cad7c118f08b5d68ddae766257f91496f5db946c696f3a99efb13
7
- data.tar.gz: 4d16d14e56f6734e1d0516794979e10d2ba8bd3719e97a295f124f58c914841df0fcf0a04929ad31516da7e8b2b0056203dd4a5af12e69d86e2e1d382c0efd71