pg_fulltext 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/pg_fulltext/query.rb +6 -6
- 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: b8701d60187af1ad0460c88d00294d05e4a2b844276ad8b3986b29babc41be15
|
4
|
+
data.tar.gz: 3618abfbe086adfef098af5c2c7672d1021bf86839cd8503c76caa5961ccae6b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ed5a212569e382a8b40a6dcc67f1f24a3af1adcb5dee59d28721db890a7da93dffa16afec5b79dfcd53b19d525369171a24078b9586389f677df7883a8b2e56
|
7
|
+
data.tar.gz: ca268b23a69304788491dad1f79680b91d56714cadd45b175aeed9773a02088c9ffc4a83704f831d7c8d755a4b48b537e905614142dfa6c26c511babb9d517cf
|
data/lib/pg_fulltext/query.rb
CHANGED
@@ -6,12 +6,12 @@ module PgFulltext
|
|
6
6
|
rule(/!+/)
|
7
7
|
rule(/"+/)
|
8
8
|
|
9
|
-
rule(/(!?)[\p{L}!]+/) { |v| [:WORD, v] }
|
9
|
+
rule(/(!?)[0-9\p{L}!]+/) { |v| [:WORD, v] }
|
10
10
|
rule(/"[\p{L}\s!]+"/) { |v| [:PHRASE, v[1..-2]] }
|
11
11
|
rule(/!"[\p{L}\s!]+"/) { |v| [:NOT_PHRASE, v[2..-2]] }
|
12
12
|
|
13
13
|
rule(/\s+/)
|
14
|
-
rule(/[^\p{L}
|
14
|
+
rule(/[^\p{L}\s"]+/)
|
15
15
|
end
|
16
16
|
|
17
17
|
def self.to_tsquery_string(query, prefix: true, operator: '&')
|
@@ -36,10 +36,10 @@ module PgFulltext
|
|
36
36
|
|
37
37
|
def self.normalize_query(query)
|
38
38
|
query
|
39
|
-
.gsub(/[.,]/, ' ')
|
40
|
-
.gsub(/[^\s\p{L}"!]/, '')
|
41
|
-
.gsub(/\s+/, ' ')
|
42
|
-
.strip
|
39
|
+
.gsub(/[.,]/, ' ') # Replace all periods and commas with spaces (reasonable delimiters)
|
40
|
+
.gsub(/[^\s\p{L}0-9"!]/, '') # Remove all non-unicode, whitespace, numbers, quotes ("), and bangs (!)
|
41
|
+
.gsub(/\s+/, ' ') # Replace repeat whitespace occurrences with single spaces
|
42
|
+
.strip # Strip space from beginning and end of line
|
43
43
|
end
|
44
44
|
|
45
45
|
def self.format_term(term, prefix: true)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pg_fulltext
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Robertson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-11-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|