pg_search 2.1.2 → 2.3.6

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.
Files changed (66) hide show
  1. checksums.yaml +5 -5
  2. data/.codeclimate.yml +1 -0
  3. data/.editorconfig +10 -0
  4. data/.github/dependabot.yml +11 -0
  5. data/.github/workflows/ci.yml +75 -0
  6. data/.jrubyrc +1 -0
  7. data/.rubocop.yml +95 -10
  8. data/.travis.yml +26 -48
  9. data/CHANGELOG.md +179 -112
  10. data/CODE_OF_CONDUCT.md +76 -0
  11. data/CONTRIBUTING.md +5 -3
  12. data/Gemfile +6 -4
  13. data/LICENSE +1 -1
  14. data/README.md +307 -198
  15. data/Rakefile +7 -3
  16. data/lib/pg_search/configuration/association.rb +2 -0
  17. data/lib/pg_search/configuration/column.rb +2 -0
  18. data/lib/pg_search/configuration/foreign_column.rb +2 -0
  19. data/lib/pg_search/configuration.rb +20 -6
  20. data/lib/pg_search/document.rb +7 -5
  21. data/lib/pg_search/features/dmetaphone.rb +7 -7
  22. data/lib/pg_search/features/feature.rb +4 -2
  23. data/lib/pg_search/features/trigram.rb +31 -5
  24. data/lib/pg_search/features/tsearch.rb +18 -14
  25. data/lib/pg_search/features.rb +2 -0
  26. data/lib/pg_search/migration/dmetaphone_generator.rb +3 -1
  27. data/lib/pg_search/migration/generator.rb +4 -2
  28. data/lib/pg_search/migration/multisearch_generator.rb +2 -1
  29. data/lib/pg_search/migration/templates/add_pg_search_dmetaphone_support_functions.rb.erb +6 -6
  30. data/lib/pg_search/migration/templates/create_pg_search_documents.rb.erb +3 -3
  31. data/lib/pg_search/model.rb +57 -0
  32. data/lib/pg_search/multisearch/rebuilder.rb +14 -6
  33. data/lib/pg_search/multisearch.rb +23 -6
  34. data/lib/pg_search/multisearchable.rb +10 -6
  35. data/lib/pg_search/normalizer.rb +2 -0
  36. data/lib/pg_search/railtie.rb +2 -0
  37. data/lib/pg_search/scope_options.rb +26 -49
  38. data/lib/pg_search/tasks.rb +5 -1
  39. data/lib/pg_search/version.rb +3 -1
  40. data/lib/pg_search.rb +17 -55
  41. data/pg_search.gemspec +19 -11
  42. data/spec/.rubocop.yml +2 -2
  43. data/spec/integration/.rubocop.yml +11 -0
  44. data/spec/integration/associations_spec.rb +125 -162
  45. data/spec/integration/deprecation_spec.rb +33 -0
  46. data/spec/integration/pagination_spec.rb +10 -8
  47. data/spec/integration/pg_search_spec.rb +359 -306
  48. data/spec/integration/single_table_inheritance_spec.rb +18 -17
  49. data/spec/lib/pg_search/configuration/association_spec.rb +17 -13
  50. data/spec/lib/pg_search/configuration/column_spec.rb +2 -0
  51. data/spec/lib/pg_search/configuration/foreign_column_spec.rb +6 -4
  52. data/spec/lib/pg_search/features/dmetaphone_spec.rb +6 -4
  53. data/spec/lib/pg_search/features/trigram_spec.rb +51 -20
  54. data/spec/lib/pg_search/features/tsearch_spec.rb +29 -21
  55. data/spec/lib/pg_search/multisearch/rebuilder_spec.rb +151 -85
  56. data/spec/lib/pg_search/multisearch_spec.rb +67 -37
  57. data/spec/lib/pg_search/multisearchable_spec.rb +217 -123
  58. data/spec/lib/pg_search/normalizer_spec.rb +14 -10
  59. data/spec/lib/pg_search_spec.rb +102 -89
  60. data/spec/spec_helper.rb +25 -6
  61. data/spec/support/database.rb +19 -21
  62. data/spec/support/with_model.rb +2 -0
  63. metadata +106 -29
  64. data/.autotest +0 -5
  65. data/.rubocop_todo.yml +0 -163
  66. data/Guardfile +0 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 39a86d998120bf6ec9643f8f8b549b08956576ff
4
- data.tar.gz: fd3a0e7c1aea025553e4c1747d009a9911628d37
2
+ SHA256:
3
+ metadata.gz: 43a62057153fd9e33ed21bc6ce1a420b5fbeaad46e9b047bd1e039c9c7ab6ad2
4
+ data.tar.gz: 15759abc9542c0b7ddc6060e156e7eff74d78cceef5bb06c4bdfa562e029722b
5
5
  SHA512:
6
- metadata.gz: 84aa3f0816a2aca1523b9bd418abb4445b2290eb5a3177870e43a52e1ca341271e9211042496198b8e2d9ba7c39c6b53afd2f10bc272544478976bafde763265
7
- data.tar.gz: e4657a3efc304b264cb0640c1755be9f9cbbc01afb1804f5625dfea24498f5ab21b1e707801cf3c22df63e462bb7add5e737060a6f9b67ddbfbae600d53a3a5c
6
+ metadata.gz: 6c1fc5c20a82e45a4fd6381fc56fd940dcd85cce2039e2e7f5159e0c939146d0176f1970481c29205bd7d7737022007d3d78cddc3fa93603a67221fa272d1a4e
7
+ data.tar.gz: 06a4f487a2cef2fd7b55bf5f650f6e13cec3528b6514f72e6dce69943c67d879f42c795d46c7aa442b2abfe789e4459f10437df94e955f9bfbe54968e9297e39
data/.codeclimate.yml CHANGED
@@ -9,6 +9,7 @@ engines:
9
9
  enabled: true
10
10
  rubocop:
11
11
  enabled: true
12
+ channel: rubocop-0-78
12
13
  ratings:
13
14
  paths:
14
15
  - "**.rb"
data/.editorconfig ADDED
@@ -0,0 +1,10 @@
1
+ # EditorConfig is awesome: https://EditorConfig.org
2
+
3
+ root = true
4
+
5
+ [*]
6
+ end_of_line = lf
7
+ insert_final_newline = true
8
+ charset = utf-8
9
+ indent_style = space
10
+ indent_size = 2
@@ -0,0 +1,11 @@
1
+ # To get started with Dependabot version updates, you'll need to specify which
2
+ # package ecosystems to update and where the package manifests are located.
3
+ # Please see the documentation for all configuration options:
4
+ # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5
+
6
+ version: 2
7
+ updates:
8
+ - package-ecosystem: "bundler" # See documentation for possible values
9
+ directory: "/" # Location of package manifests
10
+ schedule:
11
+ interval: "daily"
@@ -0,0 +1,75 @@
1
+ name: build
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ - github-actions
8
+ pull_request:
9
+ branches:
10
+ - master
11
+
12
+ jobs:
13
+ test:
14
+ runs-on: ubuntu-latest
15
+ services:
16
+ postgres:
17
+ image: postgres:latest
18
+ env:
19
+ POSTGRES_USER: postgres
20
+ POSTGRES_PASSWORD: postgres
21
+ options: >-
22
+ --health-cmd pg_isready
23
+ --health-interval 10s
24
+ --health-timeout 5s
25
+ --health-retries 5
26
+ ports:
27
+ - 5432:5432
28
+ env:
29
+ CI: true
30
+ PGHOST: 127.0.0.1
31
+ PGUSER: postgres
32
+ PGPASS: postgres
33
+ strategy:
34
+ fail-fast: false
35
+ matrix:
36
+ ruby-version: ['2.6', '2.7', '3.0', '3.1']
37
+ active-record-version-env:
38
+ - ACTIVE_RECORD_VERSION="~> 5.2.0"
39
+ - ACTIVE_RECORD_VERSION="~> 6.0.0"
40
+ - ACTIVE_RECORD_VERSION="~> 6.1.0"
41
+ - ACTIVE_RECORD_VERSION="~> 7.0.0"
42
+ allow-failure: [false]
43
+ include:
44
+ - ruby-version: '3.1'
45
+ active-record-version-env: ACTIVE_RECORD_BRANCH="7-0-stable"
46
+ allow-failure: true
47
+ - ruby-version: '3.1'
48
+ active-record-version-env: ACTIVE_RECORD_BRANCH="6-1-stable"
49
+ allow-failure: true
50
+ exclude:
51
+ - ruby-version: '3.0'
52
+ active-record-version-env: ACTIVE_RECORD_VERSION="~> 5.2.0"
53
+ allow-failure: false
54
+ - ruby-version: '3.1'
55
+ active-record-version-env: ACTIVE_RECORD_VERSION="~> 5.2.0"
56
+ allow-failure: false
57
+ - ruby-version: '2.6'
58
+ active-record-version-env: ACTIVE_RECORD_VERSION="~> 7.0.0"
59
+ allow-failure: false
60
+ continue-on-error: ${{ matrix.allow-failure }}
61
+ steps:
62
+ - uses: actions/checkout@v2
63
+ - name: Set up Ruby
64
+ uses: ruby/setup-ruby@v1
65
+ with:
66
+ ruby-version: ${{ matrix.ruby-version }}
67
+ bundler-cache: true
68
+ - name: Set up test database
69
+ env:
70
+ PGPASSWORD: postgres
71
+ run: createdb pg_search_test
72
+ - name: Update bundle
73
+ run: ${{ matrix.active-record-version-env }} bundle update
74
+ - name: Run tests
75
+ run: ${{ matrix.active-record-version-env }} bundle exec rake
data/.jrubyrc ADDED
@@ -0,0 +1 @@
1
+ debug.fullTrace=true
data/.rubocop.yml CHANGED
@@ -1,28 +1,32 @@
1
- inherit_from: .rubocop_todo.yml
1
+ require:
2
+ - rubocop-performance
3
+ - rubocop-rails
4
+ - rubocop-rake
5
+ - rubocop-rspec
2
6
 
3
7
  AllCops:
8
+ TargetRubyVersion: 2.6
9
+ NewCops: enable
4
10
  Exclude:
5
11
  - bin/**/*
12
+ - vendor/**/*
6
13
 
7
14
  Style/StringLiterals:
8
15
  Enabled: false
9
16
 
10
- Metrics/LineLength:
17
+ Layout/LineLength:
11
18
  Max: 120
12
19
 
13
20
  Metrics/MethodLength:
14
- Max: 21
21
+ Max: 15
15
22
 
16
23
  Metrics/BlockLength:
17
24
  Exclude:
18
25
  - spec/**/*
19
26
 
20
- Layout/AlignParameters:
27
+ Layout/ParameterAlignment:
21
28
  EnforcedStyle: with_fixed_indentation
22
29
 
23
- Style/HashSyntax:
24
- Enabled: false
25
-
26
30
  Style/NumericPredicate:
27
31
  Enabled: false
28
32
 
@@ -46,7 +50,88 @@ Bundler/DuplicatedGem:
46
50
  Style/EmptyMethod:
47
51
  EnforcedStyle: expanded
48
52
 
49
- # Waiting on false positives to go away with:
50
- # https://github.com/bbatsov/rubocop/pull/5230
51
- Style/FormatStringToken:
53
+ Layout/FirstArrayElementIndentation:
54
+ EnforcedStyle: consistent
55
+
56
+ Style/Documentation:
57
+ Enabled: false
58
+
59
+ Style/WordArray:
60
+ EnforcedStyle: percent
61
+ MinSize: 3
62
+
63
+ Style/HashEachMethods:
64
+ Enabled: true
65
+
66
+ Style/HashTransformKeys:
67
+ Enabled: true
68
+
69
+ Style/HashTransformValues:
70
+ Enabled: true
71
+
72
+ Rails/ApplicationRecord:
73
+ Enabled: false
74
+
75
+ Rails/TimeZone:
76
+ Enabled: false
77
+
78
+ RSpec/ContextWording:
79
+ Prefixes:
80
+ - using
81
+ - via
82
+ - when
83
+ - with
84
+ - without
85
+
86
+ Lint/RaiseException:
87
+ Enabled: true
88
+
89
+ Lint/StructNewOverride:
90
+ Enabled: true
91
+
92
+ Layout/SpaceAroundMethodCallOperator:
93
+ Enabled: true
94
+
95
+ Style/ExponentialNotation:
96
+ Enabled: true
97
+
98
+ RSpec/DescribedClass:
99
+ Enabled: true
100
+
101
+ RSpec/ExpectInHook:
102
+ Enabled: false
103
+
104
+ RSpec/FilePath:
105
+ CustomTransform:
106
+ TSearch: "tsearch"
107
+ DMetaphone: "dmetaphone"
108
+
109
+ Layout/EmptyLinesAroundAttributeAccessor:
110
+ Enabled: true
111
+
112
+ Lint/DeprecatedOpenSSLConstant:
113
+ Enabled: true
114
+
115
+ Style/SlicingWithRange:
116
+ Enabled: true
117
+
118
+ Lint/MixedRegexpCaptureTypes:
119
+ Enabled: true
120
+
121
+ Style/RedundantFetchBlock:
122
+ Enabled: true
123
+
124
+ Style/RedundantRegexpCharacterClass:
125
+ Enabled: true
126
+
127
+ Style/RedundantRegexpEscape:
128
+ Enabled: true
129
+
130
+ RSpec/MultipleExpectations:
131
+ Max: 5
132
+
133
+ RSpec/ExampleLength:
134
+ Max: 15
135
+
136
+ Rails/RakeEnvironment:
52
137
  Enabled: false
data/.travis.yml CHANGED
@@ -1,59 +1,37 @@
1
1
  language: ruby
2
- sudo: false
2
+ bundler_args: --binstubs
3
+ cache: bundler
3
4
 
4
5
  rvm:
5
- - "2.4.1"
6
- - "2.3.4"
7
- - "2.2.7"
8
- - "2.1.10"
9
- - jruby-9.1.14.0
6
+ - 3.0.1
7
+ - 2.7.3
8
+ - 2.6.7
9
+
10
+ services:
11
+ - postgresql
10
12
 
11
13
  env:
12
- - ACTIVE_RECORD_BRANCH="master"
13
- - ACTIVE_RECORD_BRANCH="5-1-stable"
14
- - ACTIVE_RECORD_BRANCH="5-0-stable"
15
- - ACTIVE_RECORD_BRANCH="4-2-stable"
16
- - ACTIVE_RECORD_VERSION="~> 5.2.0.beta2"
17
- - ACTIVE_RECORD_VERSION="~> 5.1.0"
18
- - ACTIVE_RECORD_VERSION="~> 5.0.0"
19
- - ACTIVE_RECORD_VERSION="~> 4.2.9"
14
+ jobs:
15
+ - ACTIVE_RECORD_BRANCH="main"
16
+ - ACTIVE_RECORD_BRANCH="6-1-stable"
17
+ - ACTIVE_RECORD_BRANCH="6-0-stable"
18
+ - ACTIVE_RECORD_VERSION="~> 6.1.0"
19
+ - ACTIVE_RECORD_VERSION="~> 6.0.0"
20
+ - ACTIVE_RECORD_VERSION="~> 5.2.0"
20
21
 
21
- matrix:
22
+ jobs:
22
23
  allow_failures:
23
- - env: ACTIVE_RECORD_BRANCH="master"
24
- - env: ACTIVE_RECORD_BRANCH="5-1-stable"
25
- - env: ACTIVE_RECORD_BRANCH="5-0-stable"
26
- - env: ACTIVE_RECORD_BRANCH="4-2-stable"
27
- - rvm: jruby-9.1.14.0
24
+ - env: ACTIVE_RECORD_BRANCH="main"
25
+ - env: ACTIVE_RECORD_BRANCH="6-0-stable"
26
+ - env: ACTIVE_RECORD_BRANCH="6-1-stable"
28
27
  exclude:
29
- - rvm: "2.1.10"
30
- env: ACTIVE_RECORD_BRANCH="master"
31
- - rvm: "2.1.10"
32
- env: ACTIVE_RECORD_BRANCH="5-1-stable"
33
- - rvm: "2.1.10"
34
- env: ACTIVE_RECORD_BRANCH="5-0-stable"
35
- - rvm: "2.1.10"
36
- env: ACTIVE_RECORD_VERSION="~> 5.1.0"
37
- - rvm: "2.1.10"
38
- env: ACTIVE_RECORD_VERSION="~> 5.0.0"
39
- - rvm: jruby-9.1.14.0
40
- env: ACTIVE_RECORD_BRANCH="master"
41
- - rvm: jruby-9.1.14.0
42
- env: ACTIVE_RECORD_BRANCH="5-1-stable"
43
- - rvm: jruby-9.1.14.0
44
- env: ACTIVE_RECORD_BRANCH="5-0-stable"
45
- - rvm: jruby-9.1.14.0
46
- env: ACTIVE_RECORD_VERSION="~> 5.2.0.beta2"
47
- - rvm: jruby-9.1.14.0
48
- env: ACTIVE_RECORD_VERSION="~> 5.1.0"
49
- - rvm: jruby-9.1.14.0
50
- env: ACTIVE_RECORD_VERSION="~> 5.0.0"
28
+ - rvm: 3.0.1
29
+ env: ACTIVE_RECORD_VERSION="~> 5.2.0"
30
+ - rvm: 2.6.7
31
+ env: ACTIVE_RECORD_BRANCH="main"
51
32
 
52
33
  before_script:
53
- - "psql -c 'create database pg_search_test;' -U postgres >/dev/null"
54
-
55
- script: "bin/rake"
34
+ - psql --version
35
+ - psql -c 'create database pg_search_test;' -U postgres >/dev/null
56
36
 
57
- addons:
58
- code_climate:
59
- repo_token: 0a0e3e45118bc447e677d52c21d056a5471c4921d54f96ed7b2550d9fc5043ea
37
+ script: bin/rake