faceted_search 3.6.1 → 3.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -0
- data/app/models/faceted_search/facets/default_list.rb +8 -29
- data/lib/faceted_search/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: 4633222e5bf581e90266ca8760dc45b829ead22a1ead7ec2b2bf618184c62f0f
|
4
|
+
data.tar.gz: db09d9655daaf66365dcacf7f886cca41ca82b789c46a6f15303a7b7504d2ef2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 660f10b2f9945c85a9a6b1ba298ff7a2ec1e9d092007bab2922773f31f005fd017ea270631026240006260089af083f2f66ff344d1682f6cd39ba6f9bb90fe1d
|
7
|
+
data.tar.gz: 9e72bb6ac253c60bce9527c649c5f598c6e14e4921f28b2a41b2e0ea0f868082d22238c49f883131a6e65ae4349263186c7d7cc6ec994211f302c504f77ea081
|
data/README.md
CHANGED
@@ -18,15 +18,19 @@ module FacetedSearch
|
|
18
18
|
# and return the modified scope
|
19
19
|
def add_scope(scope)
|
20
20
|
return scope if params_array.blank?
|
21
|
-
habtm? ?
|
22
|
-
:
|
21
|
+
habtm? ? scope.joins(name).where(name => { find_by => params_array })
|
22
|
+
: scope.where(name => params_array)
|
23
23
|
end
|
24
24
|
|
25
25
|
# Show all values that have corresponding results with the current params.
|
26
26
|
# This is a regular SQL inner join.
|
27
27
|
def values
|
28
|
-
@values ||=
|
29
|
-
|
28
|
+
@values ||= begin
|
29
|
+
joined_table = facets.model_table_name.to_sym
|
30
|
+
results = params_array.blank? ? facets.results : facets.results_except(param_name)
|
31
|
+
values = source.all.joins(joined_table)
|
32
|
+
values.where(joined_table => { id: results }).or(values.where(id: params_array)).distinct
|
33
|
+
end
|
30
34
|
end
|
31
35
|
|
32
36
|
def value_selected?(value)
|
@@ -43,31 +47,6 @@ module FacetedSearch
|
|
43
47
|
|
44
48
|
protected
|
45
49
|
|
46
|
-
def add_scope_with_habtm_true(scope)
|
47
|
-
scope.joins(name).where(name => { find_by => params_array })
|
48
|
-
end
|
49
|
-
|
50
|
-
def add_scope_with_habtm_false(scope)
|
51
|
-
scope.where(name => params_array)
|
52
|
-
end
|
53
|
-
|
54
|
-
def results
|
55
|
-
params_array.blank? ? facets.results : facets.results_except(param_name)
|
56
|
-
end
|
57
|
-
|
58
|
-
def values_with_habtm_true
|
59
|
-
joined_table = facets.model_table_name.to_sym
|
60
|
-
values = source.all.joins(joined_table)
|
61
|
-
values.where(joined_table => { id: results }).or(values.where(id: params_array)).distinct
|
62
|
-
rescue
|
63
|
-
end
|
64
|
-
|
65
|
-
def values_with_habtm_false
|
66
|
-
property = "#{name}_id"
|
67
|
-
ids = results.pluck property
|
68
|
-
source.where(id: ids)
|
69
|
-
end
|
70
|
-
|
71
50
|
def params_array
|
72
51
|
@params_array ||= @params.to_s.split(',')
|
73
52
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: faceted_search
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.6.
|
4
|
+
version: 3.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arnaud Levy
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2023-
|
13
|
+
date: 2023-04-04 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|