pg_search 2.3.6 → 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.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +47 -35
  3. data/.github/workflows/codeql.yml +87 -0
  4. data/.standard.yml +6 -0
  5. data/CHANGELOG.md +23 -0
  6. data/Gemfile +21 -6
  7. data/LICENSE +1 -1
  8. data/README.md +133 -114
  9. data/Rakefile +4 -13
  10. data/lib/pg_search/configuration/column.rb +6 -4
  11. data/lib/pg_search/configuration/foreign_column.rb +1 -1
  12. data/lib/pg_search/configuration.rb +11 -27
  13. data/lib/pg_search/document.rb +8 -8
  14. data/lib/pg_search/features/dmetaphone.rb +1 -1
  15. data/lib/pg_search/features/trigram.rb +4 -4
  16. data/lib/pg_search/features/tsearch.rb +23 -30
  17. data/lib/pg_search/migration/dmetaphone_generator.rb +2 -2
  18. data/lib/pg_search/migration/generator.rb +5 -5
  19. data/lib/pg_search/migration/multisearch_generator.rb +2 -2
  20. data/lib/pg_search/model.rb +12 -14
  21. data/lib/pg_search/multisearch/rebuilder.rb +4 -3
  22. data/lib/pg_search/multisearch.rb +4 -2
  23. data/lib/pg_search/multisearchable.rb +7 -7
  24. data/lib/pg_search/normalizer.rb +17 -7
  25. data/lib/pg_search/scope_options.rb +36 -8
  26. data/lib/pg_search/tasks.rb +2 -2
  27. data/lib/pg_search/version.rb +1 -1
  28. data/lib/pg_search.rb +3 -3
  29. data/pg_search.gemspec +16 -31
  30. data/spec/integration/associations_spec.rb +118 -106
  31. data/spec/integration/deprecation_spec.rb +12 -9
  32. data/spec/integration/pagination_spec.rb +1 -0
  33. data/spec/integration/pg_search_spec.rb +343 -298
  34. data/spec/integration/single_table_inheritance_spec.rb +7 -5
  35. data/spec/lib/pg_search/configuration/association_spec.rb +17 -15
  36. data/spec/lib/pg_search/configuration/column_spec.rb +13 -1
  37. data/spec/lib/pg_search/configuration/foreign_column_spec.rb +5 -4
  38. data/spec/lib/pg_search/features/dmetaphone_spec.rb +4 -4
  39. data/spec/lib/pg_search/features/trigram_spec.rb +32 -33
  40. data/spec/lib/pg_search/features/tsearch_spec.rb +57 -39
  41. data/spec/lib/pg_search/multisearch/rebuilder_spec.rb +70 -20
  42. data/spec/lib/pg_search/multisearch_spec.rb +8 -8
  43. data/spec/lib/pg_search/multisearchable_spec.rb +34 -26
  44. data/spec/lib/pg_search/normalizer_spec.rb +11 -11
  45. data/spec/lib/pg_search_spec.rb +22 -18
  46. data/spec/spec_helper.rb +3 -18
  47. data/spec/support/database.rb +6 -6
  48. metadata +11 -219
  49. data/.codeclimate.yml +0 -17
  50. data/.rubocop.yml +0 -137
  51. data/.travis.yml +0 -37
  52. data/spec/.rubocop.yml +0 -14
  53. data/spec/integration/.rubocop.yml +0 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 43a62057153fd9e33ed21bc6ce1a420b5fbeaad46e9b047bd1e039c9c7ab6ad2
4
- data.tar.gz: 15759abc9542c0b7ddc6060e156e7eff74d78cceef5bb06c4bdfa562e029722b
3
+ metadata.gz: 19d829bcebb6f71fe198f833221ac95046c86fc8a464050ee018480e811c17cc
4
+ data.tar.gz: 20e57c883dda915b997ef6dbfe15244f8662c3900ee847538a1d1be358a4bc81
5
5
  SHA512:
6
- metadata.gz: 6c1fc5c20a82e45a4fd6381fc56fd940dcd85cce2039e2e7f5159e0c939146d0176f1970481c29205bd7d7737022007d3d78cddc3fa93603a67221fa272d1a4e
7
- data.tar.gz: 06a4f487a2cef2fd7b55bf5f650f6e13cec3528b6514f72e6dce69943c67d879f42c795d46c7aa442b2abfe789e4459f10437df94e955f9bfbe54968e9297e39
6
+ metadata.gz: abd3ce5a816507a6cfe608fedea53d6c7fa4b104d1e85ea3e1e87b074d33160002fded3d2595aac5edfd43a6b59bfdffaf1cbc7a9ffdeace30bf5d01ae81af25
7
+ data.tar.gz: '092545c6d541290cb8f089718d472f98167be48bd20d1f6efb922d8fe5f38f175131b8d79f291c6c6b6465fc39cea2f824c1141fb3689e9ef9dddef9e85376cb'
@@ -8,10 +8,22 @@ on:
8
8
  pull_request:
9
9
  branches:
10
10
  - master
11
+ schedule:
12
+ - cron: "0 18 * * 6" # Saturdays at 12pm CST
13
+ workflow_dispatch:
14
+
15
+ permissions:
16
+ contents: read
17
+
18
+ concurrency:
19
+ group: ${{ github.workflow }}-${{ github.ref }}
20
+ cancel-in-progress: ${{ github.event_name == 'pull_request' }}
11
21
 
12
22
  jobs:
13
23
  test:
24
+ name: Ruby ${{ matrix.ruby-version }} / Active Record ${{ matrix.active-record.label }}
14
25
  runs-on: ubuntu-latest
26
+ timeout-minutes: 20
15
27
  services:
16
28
  postgres:
17
29
  image: postgres:latest
@@ -29,47 +41,47 @@ jobs:
29
41
  CI: true
30
42
  PGHOST: 127.0.0.1
31
43
  PGUSER: postgres
32
- PGPASS: postgres
33
44
  strategy:
34
45
  fail-fast: false
35
46
  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"
47
+ ruby-version: ["3.3", "3.4", "4.0"]
48
+ active-record:
49
+ - { label: "7.2", env: "ACTIVE_RECORD_VERSION=~> 7.2.0" }
50
+ - { label: "8.0", env: "ACTIVE_RECORD_VERSION=~> 8.0.0" }
51
+ - { label: "8.1", env: "ACTIVE_RECORD_VERSION=~> 8.1.0" }
42
52
  allow-failure: [false]
43
53
  include:
44
- - ruby-version: '3.1'
45
- active-record-version-env: ACTIVE_RECORD_BRANCH="7-0-stable"
54
+ - ruby-version: "4.0"
55
+ active-record: { label: "main", env: "ACTIVE_RECORD_BRANCH=main" }
56
+ allow-failure: true
57
+ - ruby-version: "4.0"
58
+ active-record: { label: "8-1-stable", env: "ACTIVE_RECORD_BRANCH=8-1-stable" }
59
+ allow-failure: true
60
+ - ruby-version: "4.0"
61
+ active-record: { label: "8-0-stable", env: "ACTIVE_RECORD_BRANCH=8-0-stable" }
46
62
  allow-failure: true
47
- - ruby-version: '3.1'
48
- active-record-version-env: ACTIVE_RECORD_BRANCH="6-1-stable"
63
+ - ruby-version: "4.0"
64
+ active-record: { label: "7-2-stable", env: "ACTIVE_RECORD_BRANCH=7-2-stable" }
65
+ allow-failure: true
66
+ - ruby-version: "ruby-head"
67
+ active-record: { label: "8.1", env: "ACTIVE_RECORD_VERSION=~> 8.1.0" }
49
68
  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
69
  continue-on-error: ${{ matrix.allow-failure }}
61
70
  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
71
+ - uses: actions/checkout@v6
72
+ - name: Select ActiveRecord version
73
+ env:
74
+ ACTIVE_RECORD_ENV: ${{ matrix.active-record.env }}
75
+ run: echo "$ACTIVE_RECORD_ENV" >> "$GITHUB_ENV"
76
+ - name: Set up Ruby
77
+ uses: ruby/setup-ruby@v1
78
+ with:
79
+ ruby-version: ${{ matrix.ruby-version }}
80
+ bundler-cache: true
81
+ cache-version: ${{ matrix.active-record.env }}
82
+ - name: Set up test database
83
+ env:
84
+ PGPASSWORD: postgres
85
+ run: createdb pg_search_test
86
+ - name: Run tests
87
+ run: bundle exec rake
@@ -0,0 +1,87 @@
1
+ # For most projects, this workflow file will not need changing; you simply need
2
+ # to commit it to your repository.
3
+ #
4
+ # You may wish to alter this file to override the set of languages analyzed,
5
+ # or to provide custom queries or build logic.
6
+ #
7
+ # ******** NOTE ********
8
+ # We have attempted to detect the languages in your repository. Please check
9
+ # the `language` matrix defined below to confirm you have the correct set of
10
+ # supported CodeQL languages.
11
+ #
12
+ name: "CodeQL Advanced"
13
+
14
+ on:
15
+ push:
16
+ branches: [ "master" ]
17
+ pull_request:
18
+ branches: [ "master" ]
19
+ schedule:
20
+ - cron: '28 0 * * 1'
21
+
22
+ jobs:
23
+ analyze:
24
+ name: Analyze (${{ matrix.language }})
25
+ # Runner size impacts CodeQL analysis time. To learn more, please see:
26
+ # - https://gh.io/recommended-hardware-resources-for-running-codeql
27
+ # - https://gh.io/supported-runners-and-hardware-resources
28
+ # - https://gh.io/using-larger-runners (GitHub.com only)
29
+ # Consider using larger runners or machines with greater resources for possible analysis time improvements.
30
+ runs-on: ubuntu-latest
31
+ permissions:
32
+ # required for all workflows
33
+ security-events: write
34
+
35
+ # required to fetch internal or private CodeQL packs
36
+ packages: read
37
+
38
+ # only required for workflows in private repositories
39
+ actions: read
40
+ contents: read
41
+
42
+ strategy:
43
+ fail-fast: false
44
+ matrix:
45
+ include:
46
+ - language: actions
47
+ build-mode: none
48
+ - language: ruby
49
+ build-mode: none
50
+ steps:
51
+ - name: Checkout repository
52
+ uses: actions/checkout@v4
53
+
54
+ # Initializes the CodeQL tools for scanning.
55
+ - name: Initialize CodeQL
56
+ uses: github/codeql-action/init@v4
57
+ with:
58
+ languages: ${{ matrix.language }}
59
+ build-mode: ${{ matrix.build-mode }}
60
+ # If you wish to specify custom queries, you can do so here or in a config file.
61
+ # By default, queries listed here will override any specified in a config file.
62
+ # Prefix the list here with "+" to use these queries and those in the config file.
63
+
64
+ # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
65
+ # queries: security-extended,security-and-quality
66
+
67
+ # If the analyze step fails for one of the languages you are analyzing with
68
+ # "We were unable to automatically build your code", modify the matrix above
69
+ # to set the build mode to "manual" for that language. Then modify this step
70
+ # to build your code.
71
+ # ℹ️ Command-line programs to run using the OS shell.
72
+ # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
73
+ - name: Run manual build steps
74
+ if: matrix.build-mode == 'manual'
75
+ shell: bash
76
+ run: |
77
+ echo 'If you are using a "manual" build mode for one or more of the' \
78
+ 'languages you are analyzing, replace this with the commands to build' \
79
+ 'your code, for example:'
80
+ echo ' make bootstrap'
81
+ echo ' make release'
82
+ exit 1
83
+
84
+ - name: Perform CodeQL Analysis
85
+ uses: github/codeql-action/analyze@v4
86
+ with:
87
+ category: "/language:${{matrix.language}}"
data/.standard.yml ADDED
@@ -0,0 +1,6 @@
1
+ ruby_version: 3.3
2
+
3
+ plugins:
4
+ - standard-performance
5
+ - standard-rails:
6
+ target_rails_version: 7.2
data/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # pg_search changelog
2
2
 
3
+ ## 2.3.8
4
+
5
+ * Drop support for Ruby 3.0, 3.1, and 3.2
6
+ * Drop support for Active Record 6.1, 7.0, and 7.1
7
+ * Support Ruby 3.4 and 4.0
8
+ * Support Active Record 8.0 and 8.1
9
+ * Fix ordered searches and associated ordering that use the internal rank join (fatkodima)
10
+ * Sanitize query characters introduced by unaccent normalization (Misha Doronin)
11
+ * Support keyword arguments for dynamic rank and highlight accessors (Manuel Meurer)
12
+ * Quote custom primary key and inheritance column identifiers in multisearch rebuild SQL
13
+ * Improve documentation (Olli)
14
+
15
+ ## 2.3.7
16
+
17
+ * Drop support for Ruby 2.6 and 2.7
18
+ * Drop support for Active Record 6.0 and earlier
19
+ * Support Ruby 3.2 and 3.3
20
+ * Support Active Record 7.1
21
+ * Support Active Record 7.2 (fatkodima)
22
+ * Add U+02BB/U+02BC to disallowed tsquery characters (Vital Ryabchinskiy)
23
+ * add support for Arel::Nodes::SqlLiteral columns (Kyle Fazzari)
24
+ * Improve documentation (Prima Aulia Gusta, Ross Baird, Andy Atkinson)
25
+
3
26
  ## 2.3.6
4
27
 
5
28
  * Drop support for Ruby 2.5
data/Gemfile CHANGED
@@ -1,15 +1,30 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- source 'https://rubygems.org'
3
+ source "https://rubygems.org", cooldown: 7
4
4
 
5
5
  gemspec
6
6
 
7
- gem 'pg', '>= 0.21.0', platform: :ruby
7
+ gem "pg", ">= 0.21.0", platform: :ruby
8
8
  gem "activerecord-jdbcpostgresql-adapter", ">= 1.3.1", platform: :jruby
9
9
 
10
- if ENV['ACTIVE_RECORD_BRANCH']
11
- gem 'activerecord', git: 'https://github.com/rails/rails.git', branch: ENV['ACTIVE_RECORD_BRANCH']
12
- gem 'arel', git: 'https://github.com/rails/arel.git' if ENV['ACTIVE_RECORD_BRANCH'] == 'master'
10
+ if ENV["ACTIVE_RECORD_BRANCH"]
11
+ gem "activerecord", git: "https://github.com/rails/rails.git", branch: ENV.fetch("ACTIVE_RECORD_BRANCH", nil)
12
+ gem "arel", git: "https://github.com/rails/arel.git" if ENV.fetch("ACTIVE_RECORD_BRANCH", nil) == "master"
13
13
  end
14
14
 
15
- gem 'activerecord', ENV['ACTIVE_RECORD_VERSION'] if ENV['ACTIVE_RECORD_VERSION']
15
+ gem "activerecord", ENV.fetch("ACTIVE_RECORD_VERSION", nil) if ENV["ACTIVE_RECORD_VERSION"] # standard:disable Bundler/DuplicatedGem
16
+
17
+ gem "benchmark"
18
+ gem "debug"
19
+ gem "irb"
20
+ gem "mutex_m"
21
+ gem "rake"
22
+ gem "rspec"
23
+ gem "ruby-lsp"
24
+ gem "simplecov"
25
+ gem "simplecov-lcov"
26
+ gem "standard", require: false
27
+ gem "standard-rails", require: false
28
+ gem "standard-rspec", require: false
29
+ gem "warning"
30
+ gem "with_model"
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2010-2021 Casebook, PBC <http://www.casebook.net>
1
+ Copyright (c) 2010–2022 Casebook, PBC <http://www.casebook.net>
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  of this software and associated documentation files (the "Software"), to deal