faceted_search 3.5.9 → 3.5.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 265734657b1546de2a80bb631adf099b8758bedd7baf5f4af71a3c266cbf2547
4
- data.tar.gz: 66f75f2e72f13bb7bb67b94d613c4597a866e8cba1c1f2dc789cbae542f851a8
3
+ metadata.gz: 3701076f83d21846f5cc9a52cd74837b34dab72875285698c447bc8adf277c95
4
+ data.tar.gz: b52786bceca2f186bf7e0893d5cb8021465557b4bb4865c6407874850effb249
5
5
  SHA512:
6
- metadata.gz: de25113088db0880b13fa1aef84d86b03fe88572e54f334c7b2c7bcff4e6831a87d253c1cbb14f9483167ca5edc2ad041e34dbb8773aff732fd080ddc56fff58
7
- data.tar.gz: e687d54f22dbb7d1b00a897268b07bb5a51de83a7980dbb1f190df105c381733f1f907031490b9da6cf3bd004867f45b9cc70dd42efb3c59cf251e084838b22d
6
+ metadata.gz: 72d6aeebd895a237584c702063e376f486480d349e776afdaa0a4c4732d6d11e9f1d0497a45182d1c2ad7a6351fccc52c126e0242a3a6fd7eea0a18b8ec83812
7
+ data.tar.gz: 633cb87e9a5d78d7efc271c610bab9d76693bb80d055f3cfcbe7a68a8d89e18c9e12bb9b2ca8a2f28fb1e0416cc5d41825270f1c40342e67f079671c90630f80
@@ -4,13 +4,12 @@ module FacetedSearch
4
4
  def source
5
5
  @source ||= begin
6
6
  if @options[:source].present?
7
- @options[:source]
7
+ @options[:source].where("#{field} IS NOT NULL")
8
8
  else
9
9
  results = params_array.compact.blank? ? facets.results : facets.results_except(@name)
10
10
  results.send(:all).where("#{field} IS NOT NULL")
11
11
  end
12
12
  end
13
- @options[:source].where("#{field} IS NOT NULL")
14
13
  end
15
14
 
16
15
  def order
@@ -8,7 +8,18 @@ module FacetedSearch
8
8
 
9
9
  def add_scope(scope)
10
10
  return scope if params.blank?
11
- scope.where("#{facets.model_table_name}.#{name} ILIKE ?", "%#{self.class.sanitize_sql_like(params)}%")
11
+ scope.where(where_condition, search_term: "%#{self.class.sanitize_sql_like(params)}%")
12
+ end
13
+
14
+ protected
15
+
16
+ def where_condition
17
+ # PostgreSQL handles removing accents if `unaccent` extension is enabled
18
+ if ActiveRecord::Base.connection.adapter_name == "PostgreSQL" && ActiveRecord::Base.connection.extensions.include?('unaccent')
19
+ "unaccent(#{facets.model_table_name}.#{name}) ILIKE unaccent(:search_term)"
20
+ else
21
+ "#{facets.model_table_name}.#{name} ILIKE :search_term"
22
+ end
12
23
  end
13
24
  end
14
25
  end
@@ -1,3 +1,4 @@
1
+ <% anchor ||= '' %>
1
2
  <% if facet.values.any? %>
2
3
  <li>
3
4
  <% unless facet.title.blank? %><b><%= facet.title %></b><% end %>
@@ -1,3 +1,4 @@
1
+ <% anchor ||= '' %>
1
2
  <% if facet.values.any? %>
2
3
  <% facet.values.each do |value| %>
3
4
  <% identifier = value.send facet.find_by %>
@@ -1,3 +1,4 @@
1
+ <% anchor ||= '' %>
1
2
  <% if facet.values.any? %>
2
3
  <li>
3
4
  <% unless facet.title.blank? %><b><%= facet.title %></b><% end %>
@@ -1,3 +1,4 @@
1
+ <% anchor ||= '' %>
1
2
  <% if facet.values.any? %>
2
3
  <% facet.values.each do |year| %>
3
4
  <% if facet.value_selected?(year) %>
@@ -1,3 +1,4 @@
1
+ <% anchor ||= '' %>
1
2
  <% if facet.values.any? %>
2
3
  <li>
3
4
  <% unless facet.title.blank? %><b><%= facet.title %></b><% end %>
@@ -1,3 +1,4 @@
1
+ <% anchor ||= '' %>
1
2
  <% if facet.values.any? %>
2
3
  <%= render 'faceted_search/facets/full_tree/values-selected',
3
4
  values: facet.values_with_parent(nil),
@@ -1,3 +1,4 @@
1
+ <% anchor ||= '' %>
1
2
  <% values.each do |value| %>
2
3
  <% identifier = value.send facet.find_by %>
3
4
  <% if facet.value_selected?(identifier) %>
@@ -1,3 +1,4 @@
1
+ <% anchor ||= '' %>
1
2
  <% values.each do |value| %>
2
3
  <% identifier = value.send facet.find_by %>
3
4
  <li class="faceted__facet__full_tree__value<%= '--selected' if facet.value_selected?(identifier) %> dd-item <%= 'dd-item--selected' if facet.value_selected?(identifier) %>">
@@ -1,3 +1,4 @@
1
+ <% anchor ||= '' %>
1
2
  <% if facet.values.any? %>
2
3
  <li>
3
4
  <% unless facet.title.blank? %><b><%= facet.title %></b><% end %>
@@ -1,3 +1,4 @@
1
+ <% anchor ||= '' %>
1
2
  <% if facet.values.any? %>
2
3
  <% facet.values.each do |value| %>
3
4
  <% identifier = value.send facet.find_by %>
@@ -1,3 +1,4 @@
1
+ <% anchor ||= '' %>
1
2
  <% if facet.values.any? %>
2
3
  <li>
3
4
  <% unless facet.title.blank? %><b><%= facet.title %></b><% end %>
@@ -1,3 +1,4 @@
1
+ <% anchor ||= '' %>
1
2
  <li>
2
3
  <% unless facet.title.blank? %><b><%= facet.title %></b><% end %>
3
4
  <%
@@ -1,3 +1,4 @@
1
+ <% anchor ||= '' %>
1
2
  <% value = params[:facets][facet.name] if params[:facets] && params[:facets].has_key?(facet.name) %>
2
3
  <% unless value.blank? %>
3
4
  <%= render 'faceted_search/facets/facet-selected',
@@ -1,3 +1,4 @@
1
+ <% anchor ||= '' %>
1
2
  <li>
2
3
  <% unless facet.title.blank? %><b><%= facet.title %></b><% end %>
3
4
  <% value = params[:facets][facet.name] if params[:facets] && params[:facets].has_key?(facet.name) %>
@@ -1,3 +1,4 @@
1
+ <% anchor ||= '' %>
1
2
  <% value = params[:facets][facet.name] if params[:facets] && params[:facets].has_key?(facet.name) %>
2
3
  <% unless value.blank? %>
3
4
  <%= render 'faceted_search/facets/facet-selected',
@@ -1,3 +1,4 @@
1
+ <% anchor ||= '' %>
1
2
  <% if facet.values.any? %>
2
3
  <li>
3
4
  <% unless facet.title.blank? %><b><%= facet.title %></b><% end %>
@@ -1,3 +1,3 @@
1
1
  module FacetedSearch
2
- VERSION = '3.5.9'
2
+ VERSION = '3.5.12'
3
3
  end
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: faceted_search
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.5.9
4
+ version: 3.5.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arnaud Levy
8
8
  - Sébastien Gaya
9
9
  - Sébastien Moulène
10
- autorequire:
10
+ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2021-05-28 00:00:00.000000000 Z
13
+ date: 2022-04-27 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
@@ -170,7 +170,7 @@ homepage: http://github.com/lespoupeesrusses/faceted_search
170
170
  licenses:
171
171
  - MIT
172
172
  metadata: {}
173
- post_install_message:
173
+ post_install_message:
174
174
  rdoc_options: []
175
175
  require_paths:
176
176
  - lib
@@ -185,8 +185,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
185
185
  - !ruby/object:Gem::Version
186
186
  version: '0'
187
187
  requirements: []
188
- rubygems_version: 3.1.4
189
- signing_key:
188
+ rubygems_version: 3.1.6
189
+ signing_key:
190
190
  specification_version: 4
191
191
  summary: Faceted search with Active Record
192
192
  test_files: []