workarea-core 3.4.28 → 3.4.29
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: 293a8eac548e651d077a238236f6e127e2bd136ec50139fbe8ad18dcda7adfb7
|
4
|
+
data.tar.gz: f8173cfae95ed2e11933669e4c4aedd086edc1dff489e18ed69c2bf0aeddcede
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2cb7c1571e058e31fef6d5cce6d65e3e3afe1f3830175bb086c735eabf54e70f71399a757c5312196cfe9321b0cad0b1241dca1745d2ad99a21601079353e8ff
|
7
|
+
data.tar.gz: 72164a859e0a2cf841ecb12fac24ea670b0057209d1fab1e31d45d91399729727ad9eb06212a21f5adc3c917b2d1df33c6a1518d23b4a0c8bf9f7dd33d19887a
|
@@ -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)
|
@@ -1283,6 +1283,12 @@ module Workarea
|
|
1283
1283
|
'Workarea::Catalog::Category' => 7,
|
1284
1284
|
'Workarea::Navigation::Menu' => 1_000
|
1285
1285
|
}
|
1286
|
+
|
1287
|
+
# The max number of types of results that will show in the admin jump to
|
1288
|
+
config.jump_to_type_limit = 5
|
1289
|
+
|
1290
|
+
# The number of results that will show per-type in the admin jump to
|
1291
|
+
config.jump_to_results_per_type = 5
|
1286
1292
|
end
|
1287
1293
|
end
|
1288
1294
|
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.4.
|
4
|
+
version: 3.4.29
|
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
|