faceted_search 3.5.10 → 3.5.13

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: f4d977f19f2132c5b2bd915b5e31b8994bc3a9cfea14e437abd71335e9ade21d
4
- data.tar.gz: ee426d8c2bc8db64d11e00ec0200e292c51fbd7d056267a3389ff4ad44d75f38
3
+ metadata.gz: 4a8ff3818f88576b800821c3f4152958722d3baa7d22f18414d55ac6ac46ef0e
4
+ data.tar.gz: 0ffa91d5c127d09f0136ad63c23b096a3a5750d9fbbc585e44e3cd4785686e5e
5
5
  SHA512:
6
- metadata.gz: f73ede5472a4581e99a3a0fa8b54bd65221cc2cc02ab24d12d692ee89570aa20e57dab1849f1f0b59cc3d37b27c7037cb0b4e6d21abc2f7f33f2e0253e29cf3b
7
- data.tar.gz: c38073518e0da2178cd5a4d7e431fb315a879b8e9446d12eedf80ba4c2318b06aced9541aa8381e073e16058656de81286c6ae638f24f1a532c44436f9121961
6
+ metadata.gz: 713230c2382f554042a0258f2f1d4de5dbb74b89e21c7f92b5fb42008a7a4ffa082e86ca0067545e5238a494c0e2137e8c9273b3c0b2957d47b54381a7b9180a
7
+ data.tar.gz: aa54ae605ca1428fa6ae943569ac164ff8b5ed3fa819e6c67c5e5256584b1d7cfad2623b52b1859377cbf3483799e54bd3d79c6aa48978ec92c52f5b460729cd
@@ -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,6 +1,6 @@
1
1
  <li class=" faceted__facet-selected
2
2
  list-inline-item">
3
- <%= link_to path, class: 'badge badge-light', rel: 'nofollow' do %>
3
+ <%= link_to path, class: 'badge badge-light bg-light text-dark', rel: 'nofollow' do %>
4
4
  <% unless title %>
5
5
  <span class="faceted__facet-selected__title d-none">
6
6
  <%= title %>
@@ -1,3 +1,3 @@
1
1
  module FacetedSearch
2
- VERSION = '3.5.10'
2
+ VERSION = '3.5.13'
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.10
4
+ version: 3.5.13
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-06-01 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: []