mincer 0.2.19 → 0.2.20

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: 64a37eedb6ced542c90bbfd2c22c01f69b97b1b91f7ef541576419d3f677b1f4
4
- data.tar.gz: c010b1c52801f85643555425b0653a2c11f84b3ce780c7f15bec4ee36ffe3a3b
3
+ metadata.gz: 57615c10653f4eee6875661054d63fbb089e19578d9b23f518eb181f1325c2ae
4
+ data.tar.gz: '09833041518630ceaf52321fbfe20624ac9b2bc205404215d528abfab9a32ce0'
5
5
  SHA512:
6
- metadata.gz: c39fb4c6b1b66b1de19da7f9e9f368bbfc279224ac08dad22a3671b6020d341368052ee9c0993a7f50376376e3d4149c88747eb9b1585239cd01efdf6e190436
7
- data.tar.gz: f458164868a63d98fa26b4a885d551b62cc197f924efbea6b2f43f210dc74cbab9d3934069e3862ac9860c48c7c5ef62773cbdfd7298c38179b5b733a43fbb0b
6
+ metadata.gz: 8f05956a84834da93f1119cb71e593da3997dcf93099983d64b2d98b0b0b758947573987eccb7a34544eddd1513fb4f2531336c737d605d8300c659b14e39d61
7
+ data.tar.gz: 962e4462917b40105df7243d30bf8459cfa44951644de57ee550e80e1b50c064e7a61915bf5fa4fd653cf2c622d58a63f694f7d1340abe8b27d84d3c3747873e
data/README.md CHANGED
@@ -218,7 +218,11 @@ If you set `ignore_case` attribute to true - search will ignore case.
218
218
 
219
219
  pg_search [{ :columns => %w{employees.full_name companies.name} }, :ignore_case => true ]
220
220
 
221
- Options like `unaccent`, `any_word`, `ignore_case` can be set to be used only on query or document. In Example if you use specific column that already has unaccented and lowercased text with GIN/GIST index and do not want to additionally use `unaccent` or `ignore_case` functions on that column(because this will cause index not to work) -you can disable those options. Ex.
221
+ If you set `prefix_matching` attribute to true - lexemes in a tsquery can will be labeled with * to specify prefix matching.
222
+
223
+ pg_search [{ :columns => %w{employees.full_name companies.name} }, :prefix_matching => true ]
224
+
225
+ Options like `unaccent`, `any_word`, `ignore_case`, `prefix_matching` can be set to be used only on query or document. In Example if you use specific column that already has unaccented and lowercased text with GIN/GIST index and do not want to additionally use `unaccent` or `ignore_case` functions on that column(because this will cause index not to work) -you can disable those options. Ex.
222
226
 
223
227
  pg_search [{ :columns => %w{employees.full_name} }, :ignore_case => {query: true} ]
224
228
 
@@ -53,8 +53,11 @@ module Mincer
53
53
 
54
54
  def ts_query_for(search_statement)
55
55
  terms_delimiter = search_statement.options[:any_word] ? '|' : '&'
56
- tsquery_sql = Arel.sql(search_statement.terms.map { |term| sanitize_string_quoted(term, search_statement.sanitizers(:query)).to_sql }.join(" || ' #{terms_delimiter} ' || "))
57
- Arel::Nodes::NamedFunction.new('to_tsquery', [quote(search_statement.dictionary), tsquery_sql])
56
+ tsquery = search_statement.terms.map do |term|
57
+ _term = search_statement.options[:prefix_matching] ? "#{term}:*" : term
58
+ sanitize_string_quoted(_term, search_statement.sanitizers(:query)).to_sql
59
+ end.join(" || ' #{terms_delimiter} ' || ")
60
+ Arel::Nodes::NamedFunction.new('to_tsquery', [quote(search_statement.dictionary), Arel.sql(tsquery)])
58
61
  end
59
62
  end
60
63
 
@@ -1,7 +1,7 @@
1
1
  module Mincer
2
2
 
3
3
  def self.version
4
- Gem::Version.new '0.2.19'
4
+ Gem::Version.new '0.2.20'
5
5
  end
6
6
 
7
7
  module VERSION #:nodoc:
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mincer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.19
4
+ version: 0.2.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Krasinsky
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-13 00:00:00.000000000 Z
11
+ date: 2021-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord