sunspot 2.2.0 → 2.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/sunspot/dsl/field_query.rb +11 -9
- data/lib/sunspot/dsl/fulltext.rb +9 -1
- data/lib/sunspot/dsl/group.rb +108 -0
- data/lib/sunspot/dsl/search.rb +1 -1
- data/lib/sunspot/dsl.rb +1 -1
- data/lib/sunspot/field_factory.rb +28 -15
- data/lib/sunspot/indexer.rb +63 -17
- data/lib/sunspot/query/abstract_fulltext.rb +9 -2
- data/lib/sunspot/query/dismax.rb +11 -4
- data/lib/sunspot/query/{field_group.rb → group.rb} +16 -6
- data/lib/sunspot/query/group_query.rb +17 -0
- data/lib/sunspot/query/restriction.rb +45 -1
- data/lib/sunspot/query.rb +1 -1
- data/lib/sunspot/schema.rb +2 -1
- data/lib/sunspot/search/abstract_search.rb +7 -3
- data/lib/sunspot/search/query_group.rb +74 -0
- data/lib/sunspot/search/standard_search.rb +1 -1
- data/lib/sunspot/search.rb +1 -1
- data/lib/sunspot/session.rb +16 -0
- data/lib/sunspot/session_proxy/master_slave_session_proxy.rb +2 -2
- data/lib/sunspot/session_proxy/retry_5xx_session_proxy.rb +1 -1
- data/lib/sunspot/session_proxy/sharding_session_proxy.rb +4 -2
- data/lib/sunspot/session_proxy/silent_fail_session_proxy.rb +1 -1
- data/lib/sunspot/session_proxy/thread_local_session_proxy.rb +3 -1
- data/lib/sunspot/type.rb +20 -0
- data/lib/sunspot/version.rb +1 -1
- data/lib/sunspot.rb +36 -2
- data/spec/api/indexer/attributes_spec.rb +5 -0
- data/spec/api/query/function_spec.rb +103 -0
- data/spec/api/query/group_spec.rb +23 -1
- data/spec/api/session_proxy/sharding_session_proxy_spec.rb +1 -1
- data/spec/helpers/integration_helper.rb +9 -0
- data/spec/integration/atomic_updates_spec.rb +44 -0
- data/spec/integration/field_grouping_spec.rb +13 -0
- data/spec/integration/scoped_search_spec.rb +51 -0
- data/spec/mocks/post.rb +3 -1
- metadata +11 -15
- data/lib/sunspot/dsl/field_group.rb +0 -57
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sunspot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
5
|
-
prerelease:
|
4
|
+
version: 2.2.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Mat Brown
|
@@ -29,12 +28,11 @@ authors:
|
|
29
28
|
autorequire:
|
30
29
|
bindir: bin
|
31
30
|
cert_chain: []
|
32
|
-
date: 2015-
|
31
|
+
date: 2015-11-20 00:00:00.000000000 Z
|
33
32
|
dependencies:
|
34
33
|
- !ruby/object:Gem::Dependency
|
35
34
|
name: rsolr
|
36
35
|
requirement: !ruby/object:Gem::Requirement
|
37
|
-
none: false
|
38
36
|
requirements:
|
39
37
|
- - "~>"
|
40
38
|
- !ruby/object:Gem::Version
|
@@ -42,7 +40,6 @@ dependencies:
|
|
42
40
|
type: :runtime
|
43
41
|
prerelease: false
|
44
42
|
version_requirements: !ruby/object:Gem::Requirement
|
45
|
-
none: false
|
46
43
|
requirements:
|
47
44
|
- - "~>"
|
48
45
|
- !ruby/object:Gem::Version
|
@@ -50,7 +47,6 @@ dependencies:
|
|
50
47
|
- !ruby/object:Gem::Dependency
|
51
48
|
name: pr_geohash
|
52
49
|
requirement: !ruby/object:Gem::Requirement
|
53
|
-
none: false
|
54
50
|
requirements:
|
55
51
|
- - "~>"
|
56
52
|
- !ruby/object:Gem::Version
|
@@ -58,7 +54,6 @@ dependencies:
|
|
58
54
|
type: :runtime
|
59
55
|
prerelease: false
|
60
56
|
version_requirements: !ruby/object:Gem::Requirement
|
61
|
-
none: false
|
62
57
|
requirements:
|
63
58
|
- - "~>"
|
64
59
|
- !ruby/object:Gem::Version
|
@@ -66,7 +61,6 @@ dependencies:
|
|
66
61
|
- !ruby/object:Gem::Dependency
|
67
62
|
name: rspec
|
68
63
|
requirement: !ruby/object:Gem::Requirement
|
69
|
-
none: false
|
70
64
|
requirements:
|
71
65
|
- - "~>"
|
72
66
|
- !ruby/object:Gem::Version
|
@@ -74,7 +68,6 @@ dependencies:
|
|
74
68
|
type: :development
|
75
69
|
prerelease: false
|
76
70
|
version_requirements: !ruby/object:Gem::Requirement
|
77
|
-
none: false
|
78
71
|
requirements:
|
79
72
|
- - "~>"
|
80
73
|
- !ruby/object:Gem::Version
|
@@ -105,13 +98,13 @@ files:
|
|
105
98
|
- lib/sunspot/data_extractor.rb
|
106
99
|
- lib/sunspot/dsl.rb
|
107
100
|
- lib/sunspot/dsl/adjustable.rb
|
108
|
-
- lib/sunspot/dsl/field_group.rb
|
109
101
|
- lib/sunspot/dsl/field_query.rb
|
110
102
|
- lib/sunspot/dsl/field_stats.rb
|
111
103
|
- lib/sunspot/dsl/fields.rb
|
112
104
|
- lib/sunspot/dsl/fulltext.rb
|
113
105
|
- lib/sunspot/dsl/function.rb
|
114
106
|
- lib/sunspot/dsl/functional.rb
|
107
|
+
- lib/sunspot/dsl/group.rb
|
115
108
|
- lib/sunspot/dsl/more_like_this_query.rb
|
116
109
|
- lib/sunspot/dsl/paginatable.rb
|
117
110
|
- lib/sunspot/dsl/query_facet.rb
|
@@ -135,12 +128,13 @@ files:
|
|
135
128
|
- lib/sunspot/query/date_field_facet.rb
|
136
129
|
- lib/sunspot/query/dismax.rb
|
137
130
|
- lib/sunspot/query/field_facet.rb
|
138
|
-
- lib/sunspot/query/field_group.rb
|
139
131
|
- lib/sunspot/query/field_stats.rb
|
140
132
|
- lib/sunspot/query/filter.rb
|
141
133
|
- lib/sunspot/query/function_query.rb
|
142
134
|
- lib/sunspot/query/geo.rb
|
143
135
|
- lib/sunspot/query/geofilt.rb
|
136
|
+
- lib/sunspot/query/group.rb
|
137
|
+
- lib/sunspot/query/group_query.rb
|
144
138
|
- lib/sunspot/query/highlighting.rb
|
145
139
|
- lib/sunspot/query/join.rb
|
146
140
|
- lib/sunspot/query/more_like_this.rb
|
@@ -171,6 +165,7 @@ files:
|
|
171
165
|
- lib/sunspot/search/more_like_this_search.rb
|
172
166
|
- lib/sunspot/search/paginated_collection.rb
|
173
167
|
- lib/sunspot/search/query_facet.rb
|
168
|
+
- lib/sunspot/search/query_group.rb
|
174
169
|
- lib/sunspot/search/range_facet.rb
|
175
170
|
- lib/sunspot/search/standard_search.rb
|
176
171
|
- lib/sunspot/search/stats_facet.rb
|
@@ -254,6 +249,7 @@ files:
|
|
254
249
|
- spec/helpers/mock_session_helper.rb
|
255
250
|
- spec/helpers/query_helper.rb
|
256
251
|
- spec/helpers/search_helper.rb
|
252
|
+
- spec/integration/atomic_updates_spec.rb
|
257
253
|
- spec/integration/dynamic_fields_spec.rb
|
258
254
|
- spec/integration/faceting_spec.rb
|
259
255
|
- spec/integration/field_grouping_spec.rb
|
@@ -289,6 +285,7 @@ files:
|
|
289
285
|
homepage: http://outoftime.github.com/sunspot
|
290
286
|
licenses:
|
291
287
|
- MIT
|
288
|
+
metadata: {}
|
292
289
|
post_install_message:
|
293
290
|
rdoc_options:
|
294
291
|
- "--webcvs=http://github.com/outoftime/sunspot/tree/master/%s"
|
@@ -299,22 +296,20 @@ rdoc_options:
|
|
299
296
|
require_paths:
|
300
297
|
- lib
|
301
298
|
required_ruby_version: !ruby/object:Gem::Requirement
|
302
|
-
none: false
|
303
299
|
requirements:
|
304
300
|
- - ">="
|
305
301
|
- !ruby/object:Gem::Version
|
306
302
|
version: '0'
|
307
303
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
308
|
-
none: false
|
309
304
|
requirements:
|
310
305
|
- - ">="
|
311
306
|
- !ruby/object:Gem::Version
|
312
307
|
version: '0'
|
313
308
|
requirements: []
|
314
309
|
rubyforge_project: sunspot
|
315
|
-
rubygems_version:
|
310
|
+
rubygems_version: 2.5.0
|
316
311
|
signing_key:
|
317
|
-
specification_version:
|
312
|
+
specification_version: 4
|
318
313
|
summary: Library for expressive, powerful interaction with the Solr search engine
|
319
314
|
test_files:
|
320
315
|
- spec/api/adapters_spec.rb
|
@@ -378,6 +373,7 @@ test_files:
|
|
378
373
|
- spec/helpers/mock_session_helper.rb
|
379
374
|
- spec/helpers/query_helper.rb
|
380
375
|
- spec/helpers/search_helper.rb
|
376
|
+
- spec/integration/atomic_updates_spec.rb
|
381
377
|
- spec/integration/dynamic_fields_spec.rb
|
382
378
|
- spec/integration/faceting_spec.rb
|
383
379
|
- spec/integration/field_grouping_spec.rb
|
@@ -1,57 +0,0 @@
|
|
1
|
-
module Sunspot
|
2
|
-
module DSL
|
3
|
-
class FieldGroup
|
4
|
-
def initialize(setup, group)
|
5
|
-
@setup, @group = setup, group
|
6
|
-
end
|
7
|
-
|
8
|
-
#
|
9
|
-
# Sets the number of results (documents) to return for each group.
|
10
|
-
# Defaults to 1.
|
11
|
-
#
|
12
|
-
def limit(num)
|
13
|
-
@group.limit = num
|
14
|
-
end
|
15
|
-
|
16
|
-
#
|
17
|
-
# If set, facet counts are based on the most relevant document of
|
18
|
-
# each group matching the query.
|
19
|
-
#
|
20
|
-
# Supported in Solr 3.4 and above.
|
21
|
-
#
|
22
|
-
# ==== Example
|
23
|
-
#
|
24
|
-
# Sunspot.search(Post) do
|
25
|
-
# group :title do
|
26
|
-
# truncate
|
27
|
-
# end
|
28
|
-
#
|
29
|
-
# facet :title, :extra => :any
|
30
|
-
# end
|
31
|
-
#
|
32
|
-
def truncate
|
33
|
-
@group.truncate = true
|
34
|
-
end
|
35
|
-
|
36
|
-
# Specify the order that results should be returned in. This method can
|
37
|
-
# be called multiple times; precedence will be in the order given.
|
38
|
-
#
|
39
|
-
# ==== Parameters
|
40
|
-
#
|
41
|
-
# field_name<Symbol>:: the field to use for ordering
|
42
|
-
# direction<Symbol>:: :asc or :desc (default :asc)
|
43
|
-
#
|
44
|
-
def order_by(field_name, direction = nil)
|
45
|
-
sort =
|
46
|
-
if special = Sunspot::Query::Sort.special(field_name)
|
47
|
-
special.new(direction)
|
48
|
-
else
|
49
|
-
Sunspot::Query::Sort::FieldSort.new(
|
50
|
-
@setup.field(field_name), direction
|
51
|
-
)
|
52
|
-
end
|
53
|
-
@group.add_sort(sort)
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|