workarea-core 3.5.6 → 3.5.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/workarea/search/admin.rb +29 -17
- data/lib/workarea/configuration.rb +6 -0
- data/lib/workarea/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 26dc982f98d5ae00a8d3299b322cd6eb897329888c169a7a035e0bafad3be1e8
|
4
|
+
data.tar.gz: f3b5ae6b3bddb68b0e3d5b5c303e565e69ff812e165371e35285cd3ce04d334e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31ad3ba0206fb6c815e6af2d4af9b572dbefec26460adfa14191279f9bd8098c462eb21b61139a0003ba775ae0b6e65294745b312ba776cd44cb55931221d40f
|
7
|
+
data.tar.gz: 8ffe28be251fddeba16e2f4964ca716ea8f759d171154529414e3b826accc1a709acb15f0374916d4ff2260f64c21acdd1a44b71687bb93fadec4bc626e81e11
|
@@ -5,27 +5,39 @@ module Workarea
|
|
5
5
|
|
6
6
|
def self.jump_to(params, size = Workarea.config.default_admin_jump_to_result_count)
|
7
7
|
query = {
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
8
|
+
aggs: {
|
9
|
+
grouped_by_type: {
|
10
|
+
filter: {
|
11
|
+
match_phrase_prefix: {
|
12
|
+
jump_to_search_text: {
|
13
|
+
query: params[:q],
|
14
|
+
max_expansions: 10
|
15
|
+
}
|
16
|
+
}
|
17
|
+
},
|
18
|
+
aggs: {
|
19
|
+
type: {
|
20
|
+
terms: { field: 'facets.type', size: Workarea.config.jump_to_type_limit },
|
21
|
+
aggs: { top: { top_hits: { size: Workarea.config.jump_to_results_per_type } } }
|
22
|
+
}
|
13
23
|
}
|
14
24
|
}
|
15
|
-
}
|
16
|
-
size: size,
|
17
|
-
sort: [{ jump_to_position: :asc }]
|
25
|
+
}
|
18
26
|
}
|
19
27
|
|
20
|
-
search(query)['
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
28
|
+
aggregation = search(query)['aggregations']['grouped_by_type']['type']
|
29
|
+
aggregation['buckets']
|
30
|
+
.reduce([]) { |m, b| m + b['top']['hits']['hits'] }
|
31
|
+
.sort_by { |r| [r['_source']['jump_to_position'], r['_score']] }
|
32
|
+
.map do |result|
|
33
|
+
{
|
34
|
+
label: result['_source']['jump_to_text'],
|
35
|
+
type: result['_source']['facets']['type'],
|
36
|
+
model_class: result['_source']['model_class'],
|
37
|
+
route_helper: result['_source']['jump_to_route_helper'],
|
38
|
+
to_param: result['_source']['jump_to_param']
|
39
|
+
}
|
40
|
+
end
|
29
41
|
end
|
30
42
|
|
31
43
|
def self.for(model)
|
@@ -1291,6 +1291,12 @@ module Workarea
|
|
1291
1291
|
'Workarea::Catalog::Category' => 7,
|
1292
1292
|
'Workarea::Navigation::Menu' => 1_000
|
1293
1293
|
}
|
1294
|
+
|
1295
|
+
# The max number of types of results that will show in the admin jump to
|
1296
|
+
config.jump_to_type_limit = 5
|
1297
|
+
|
1298
|
+
# The number of results that will show per-type in the admin jump to
|
1299
|
+
config.jump_to_results_per_type = 5
|
1294
1300
|
end
|
1295
1301
|
end
|
1296
1302
|
end
|
data/lib/workarea/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: workarea-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.5.
|
4
|
+
version: 3.5.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Crouse
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-03-
|
11
|
+
date: 2020-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|