pg_search 2.3.7 → 2.3.8
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/.github/workflows/ci.yml +41 -34
- data/.github/workflows/codeql.yml +87 -0
- data/.standard.yml +2 -2
- data/CHANGELOG.md +12 -0
- data/Gemfile +4 -2
- data/README.md +88 -86
- data/Rakefile +1 -7
- data/lib/pg_search/configuration.rb +10 -26
- data/lib/pg_search/features/tsearch.rb +17 -25
- data/lib/pg_search/model.rb +6 -8
- data/lib/pg_search/multisearch/rebuilder.rb +4 -3
- data/lib/pg_search/normalizer.rb +12 -2
- data/lib/pg_search/scope_options.rb +10 -3
- data/lib/pg_search/version.rb +1 -1
- data/pg_search.gemspec +3 -3
- data/spec/integration/associations_spec.rb +12 -0
- data/spec/integration/deprecation_spec.rb +5 -1
- data/spec/integration/pagination_spec.rb +1 -0
- data/spec/integration/pg_search_spec.rb +30 -1
- data/spec/integration/single_table_inheritance_spec.rb +2 -0
- data/spec/lib/pg_search/configuration/association_spec.rb +2 -0
- data/spec/lib/pg_search/configuration/foreign_column_spec.rb +1 -0
- data/spec/lib/pg_search/features/trigram_spec.rb +5 -6
- data/spec/lib/pg_search/multisearch/rebuilder_spec.rb +53 -3
- data/spec/lib/pg_search/multisearch_spec.rb +2 -2
- data/spec/lib/pg_search/multisearchable_spec.rb +8 -0
- data/spec/lib/pg_search/normalizer_spec.rb +4 -4
- data/spec/lib/pg_search_spec.rb +4 -0
- data/spec/spec_helper.rb +0 -13
- metadata +9 -13
- data/spec/.rubocop.yml +0 -27
- data/spec/integration/.rubocop.yml +0 -11
|
@@ -8,8 +8,11 @@ describe PgSearch::Multisearchable do
|
|
|
8
8
|
|
|
9
9
|
describe "a model that is multisearchable" do
|
|
10
10
|
with_model :ModelThatIsMultisearchable do
|
|
11
|
+
table
|
|
12
|
+
|
|
11
13
|
model do
|
|
12
14
|
include PgSearch::Model
|
|
15
|
+
|
|
13
16
|
multisearchable
|
|
14
17
|
end
|
|
15
18
|
end
|
|
@@ -21,6 +24,7 @@ describe PgSearch::Multisearchable do
|
|
|
21
24
|
|
|
22
25
|
model do
|
|
23
26
|
include PgSearch::Model
|
|
27
|
+
|
|
24
28
|
multisearchable
|
|
25
29
|
|
|
26
30
|
has_many :multisearchable_children, dependent: :destroy
|
|
@@ -319,6 +323,7 @@ describe PgSearch::Multisearchable do
|
|
|
319
323
|
|
|
320
324
|
model do
|
|
321
325
|
include PgSearch::Model
|
|
326
|
+
|
|
322
327
|
multisearchable if: ->(record) { record.multisearchable? }
|
|
323
328
|
end
|
|
324
329
|
end
|
|
@@ -450,6 +455,7 @@ describe PgSearch::Multisearchable do
|
|
|
450
455
|
|
|
451
456
|
model do
|
|
452
457
|
include PgSearch::Model
|
|
458
|
+
|
|
453
459
|
multisearchable unless: ->(record) { record.not_multisearchable? }
|
|
454
460
|
end
|
|
455
461
|
end
|
|
@@ -585,6 +591,7 @@ describe PgSearch::Multisearchable do
|
|
|
585
591
|
|
|
586
592
|
model do
|
|
587
593
|
include PgSearch::Model
|
|
594
|
+
|
|
588
595
|
multisearchable if: :multisearchable?
|
|
589
596
|
end
|
|
590
597
|
end
|
|
@@ -723,6 +730,7 @@ describe PgSearch::Multisearchable do
|
|
|
723
730
|
|
|
724
731
|
model do
|
|
725
732
|
include PgSearch::Model
|
|
733
|
+
|
|
726
734
|
multisearchable unless: :not_multisearchable?
|
|
727
735
|
end
|
|
728
736
|
end
|
|
@@ -12,7 +12,7 @@ describe PgSearch::Normalizer do
|
|
|
12
12
|
node = Arel::Nodes::NamedFunction.new("foo", [Arel::Nodes.build_quoted("bar")])
|
|
13
13
|
|
|
14
14
|
normalizer = described_class.new(config)
|
|
15
|
-
expect(normalizer.add_normalization(node)).to eq("unaccent(foo('bar'))")
|
|
15
|
+
expect(normalizer.add_normalization(node)).to eq("regexp_replace(unaccent(foo('bar')), '[''?\\:]', '', 'g')")
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
context "when a custom unaccent function is specified" do
|
|
@@ -23,7 +23,7 @@ describe PgSearch::Normalizer do
|
|
|
23
23
|
config = instance_double(PgSearch::Configuration, "config", ignore: [:accents])
|
|
24
24
|
|
|
25
25
|
normalizer = described_class.new(config)
|
|
26
|
-
expect(normalizer.add_normalization(node)).to eq("my_unaccent(foo('bar'))")
|
|
26
|
+
expect(normalizer.add_normalization(node)).to eq("regexp_replace(my_unaccent(foo('bar')), '[''?\\:]', '', 'g')")
|
|
27
27
|
end
|
|
28
28
|
end
|
|
29
29
|
end
|
|
@@ -33,7 +33,7 @@ describe PgSearch::Normalizer do
|
|
|
33
33
|
config = instance_double(PgSearch::Configuration, "config", ignore: [:accents])
|
|
34
34
|
|
|
35
35
|
normalizer = described_class.new(config)
|
|
36
|
-
expect(normalizer.add_normalization("foo")).to eq("unaccent(foo)")
|
|
36
|
+
expect(normalizer.add_normalization("foo")).to eq("regexp_replace(unaccent(foo), '[''?\\:]', '', 'g')")
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
context "when a custom unaccent function is specified" do
|
|
@@ -43,7 +43,7 @@ describe PgSearch::Normalizer do
|
|
|
43
43
|
config = instance_double(PgSearch::Configuration, "config", ignore: [:accents])
|
|
44
44
|
|
|
45
45
|
normalizer = described_class.new(config)
|
|
46
|
-
expect(normalizer.add_normalization("foo")).to eq("my_unaccent(foo)")
|
|
46
|
+
expect(normalizer.add_normalization("foo")).to eq("regexp_replace(my_unaccent(foo), '[''?\\:]', '', 'g')")
|
|
47
47
|
end
|
|
48
48
|
end
|
|
49
49
|
end
|
data/spec/lib/pg_search_spec.rb
CHANGED
|
@@ -45,6 +45,7 @@ describe PgSearch do
|
|
|
45
45
|
end
|
|
46
46
|
model do
|
|
47
47
|
include PgSearch::Model
|
|
48
|
+
|
|
48
49
|
multisearchable against: :title
|
|
49
50
|
end
|
|
50
51
|
end
|
|
@@ -79,6 +80,7 @@ describe PgSearch do
|
|
|
79
80
|
end
|
|
80
81
|
model do
|
|
81
82
|
include PgSearch::Model
|
|
83
|
+
|
|
82
84
|
multisearchable against: :title
|
|
83
85
|
end
|
|
84
86
|
end
|
|
@@ -111,6 +113,7 @@ describe PgSearch do
|
|
|
111
113
|
before do
|
|
112
114
|
searchable_subclass_model = Class.new(SuperclassModel) do
|
|
113
115
|
include PgSearch::Model
|
|
116
|
+
|
|
114
117
|
multisearchable against: :content
|
|
115
118
|
end
|
|
116
119
|
stub_const("SearchableSubclassModel", searchable_subclass_model)
|
|
@@ -203,6 +206,7 @@ describe PgSearch do
|
|
|
203
206
|
before do
|
|
204
207
|
searchable_subclass_model = Class.new(SuperclassModel) do
|
|
205
208
|
include PgSearch::Model
|
|
209
|
+
|
|
206
210
|
multisearchable against: :content
|
|
207
211
|
end
|
|
208
212
|
stub_const("SearchableSubclassModel", searchable_subclass_model)
|
data/spec/spec_helper.rb
CHANGED
|
@@ -1,18 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require "warning"
|
|
4
|
-
|
|
5
|
-
# https://github.com/grodowski/undercover#setting-up-required-lcov-reporting
|
|
6
|
-
require "simplecov"
|
|
7
|
-
require "simplecov-lcov"
|
|
8
|
-
SimpleCov::Formatter::LcovFormatter.config.report_with_single_file = true
|
|
9
|
-
SimpleCov.formatter = SimpleCov::Formatter::LcovFormatter
|
|
10
|
-
SimpleCov.start do
|
|
11
|
-
add_filter(%r{^/spec/})
|
|
12
|
-
enable_coverage(:branch)
|
|
13
|
-
end
|
|
14
|
-
require "undercover"
|
|
15
|
-
|
|
16
3
|
require "bundler/setup"
|
|
17
4
|
require "pg_search"
|
|
18
5
|
|
metadata
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pg_search
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.3.
|
|
4
|
+
version: 2.3.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Grant Hutchins
|
|
8
8
|
- Case Commons, LLC
|
|
9
|
-
autorequire:
|
|
10
9
|
bindir: bin
|
|
11
10
|
cert_chain: []
|
|
12
|
-
date:
|
|
11
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
13
12
|
dependencies:
|
|
14
13
|
- !ruby/object:Gem::Dependency
|
|
15
14
|
name: activerecord
|
|
@@ -17,28 +16,28 @@ dependencies:
|
|
|
17
16
|
requirements:
|
|
18
17
|
- - ">="
|
|
19
18
|
- !ruby/object:Gem::Version
|
|
20
|
-
version: '
|
|
19
|
+
version: '7.2'
|
|
21
20
|
type: :runtime
|
|
22
21
|
prerelease: false
|
|
23
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
24
23
|
requirements:
|
|
25
24
|
- - ">="
|
|
26
25
|
- !ruby/object:Gem::Version
|
|
27
|
-
version: '
|
|
26
|
+
version: '7.2'
|
|
28
27
|
- !ruby/object:Gem::Dependency
|
|
29
28
|
name: activesupport
|
|
30
29
|
requirement: !ruby/object:Gem::Requirement
|
|
31
30
|
requirements:
|
|
32
31
|
- - ">="
|
|
33
32
|
- !ruby/object:Gem::Version
|
|
34
|
-
version: '
|
|
33
|
+
version: '7.2'
|
|
35
34
|
type: :runtime
|
|
36
35
|
prerelease: false
|
|
37
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
38
37
|
requirements:
|
|
39
38
|
- - ">="
|
|
40
39
|
- !ruby/object:Gem::Version
|
|
41
|
-
version: '
|
|
40
|
+
version: '7.2'
|
|
42
41
|
description: PgSearch builds Active Record named scopes that take advantage of PostgreSQL's
|
|
43
42
|
full text search
|
|
44
43
|
email:
|
|
@@ -52,6 +51,7 @@ files:
|
|
|
52
51
|
- ".editorconfig"
|
|
53
52
|
- ".github/dependabot.yml"
|
|
54
53
|
- ".github/workflows/ci.yml"
|
|
54
|
+
- ".github/workflows/codeql.yml"
|
|
55
55
|
- ".gitignore"
|
|
56
56
|
- ".jrubyrc"
|
|
57
57
|
- ".rspec"
|
|
@@ -89,8 +89,6 @@ files:
|
|
|
89
89
|
- lib/pg_search/tasks.rb
|
|
90
90
|
- lib/pg_search/version.rb
|
|
91
91
|
- pg_search.gemspec
|
|
92
|
-
- spec/.rubocop.yml
|
|
93
|
-
- spec/integration/.rubocop.yml
|
|
94
92
|
- spec/integration/associations_spec.rb
|
|
95
93
|
- spec/integration/deprecation_spec.rb
|
|
96
94
|
- spec/integration/pagination_spec.rb
|
|
@@ -117,7 +115,6 @@ licenses:
|
|
|
117
115
|
- MIT
|
|
118
116
|
metadata:
|
|
119
117
|
rubygems_mfa_required: 'true'
|
|
120
|
-
post_install_message:
|
|
121
118
|
rdoc_options: []
|
|
122
119
|
require_paths:
|
|
123
120
|
- lib
|
|
@@ -125,15 +122,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
125
122
|
requirements:
|
|
126
123
|
- - ">="
|
|
127
124
|
- !ruby/object:Gem::Version
|
|
128
|
-
version: '3.
|
|
125
|
+
version: '3.3'
|
|
129
126
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
130
127
|
requirements:
|
|
131
128
|
- - ">="
|
|
132
129
|
- !ruby/object:Gem::Version
|
|
133
130
|
version: '0'
|
|
134
131
|
requirements: []
|
|
135
|
-
rubygems_version:
|
|
136
|
-
signing_key:
|
|
132
|
+
rubygems_version: 4.0.18
|
|
137
133
|
specification_version: 4
|
|
138
134
|
summary: PgSearch builds Active Record named scopes that take advantage of PostgreSQL's
|
|
139
135
|
full text search
|
data/spec/.rubocop.yml
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
inherit_from:
|
|
2
|
-
- ../.rubocop.yml
|
|
3
|
-
|
|
4
|
-
RSpec/ContextWording:
|
|
5
|
-
Prefixes:
|
|
6
|
-
- using
|
|
7
|
-
- via
|
|
8
|
-
- when
|
|
9
|
-
- with
|
|
10
|
-
- without
|
|
11
|
-
|
|
12
|
-
RSpec/DescribedClass:
|
|
13
|
-
Enabled: true
|
|
14
|
-
|
|
15
|
-
RSpec/ExampleLength:
|
|
16
|
-
Max: 15
|
|
17
|
-
|
|
18
|
-
RSpec/ExpectInHook:
|
|
19
|
-
Enabled: false
|
|
20
|
-
|
|
21
|
-
RSpec/FilePath:
|
|
22
|
-
CustomTransform:
|
|
23
|
-
TSearch: "tsearch"
|
|
24
|
-
DMetaphone: "dmetaphone"
|
|
25
|
-
|
|
26
|
-
RSpec/MultipleExpectations:
|
|
27
|
-
Max: 5
|