pg_search 2.3.2 → 2.3.7

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 (58) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +11 -0
  3. data/.github/workflows/ci.yml +80 -0
  4. data/.jrubyrc +1 -0
  5. data/.standard.yml +6 -0
  6. data/CHANGELOG.md +55 -20
  7. data/CODE_OF_CONDUCT.md +76 -0
  8. data/Gemfile +19 -6
  9. data/LICENSE +1 -1
  10. data/README.md +106 -43
  11. data/Rakefile +9 -6
  12. data/lib/pg_search/configuration/column.rb +6 -4
  13. data/lib/pg_search/configuration/foreign_column.rb +1 -1
  14. data/lib/pg_search/configuration.rb +13 -3
  15. data/lib/pg_search/document.rb +9 -9
  16. data/lib/pg_search/features/dmetaphone.rb +5 -7
  17. data/lib/pg_search/features/feature.rb +1 -1
  18. data/lib/pg_search/features/trigram.rb +4 -4
  19. data/lib/pg_search/features/tsearch.rb +26 -24
  20. data/lib/pg_search/migration/dmetaphone_generator.rb +2 -2
  21. data/lib/pg_search/migration/generator.rb +5 -5
  22. data/lib/pg_search/migration/multisearch_generator.rb +2 -2
  23. data/lib/pg_search/migration/templates/add_pg_search_dmetaphone_support_functions.rb.erb +6 -6
  24. data/lib/pg_search/migration/templates/create_pg_search_documents.rb.erb +2 -2
  25. data/lib/pg_search/model.rb +6 -6
  26. data/lib/pg_search/multisearch/rebuilder.rb +2 -2
  27. data/lib/pg_search/multisearch.rb +23 -4
  28. data/lib/pg_search/multisearchable.rb +7 -7
  29. data/lib/pg_search/normalizer.rb +5 -5
  30. data/lib/pg_search/scope_options.rb +31 -13
  31. data/lib/pg_search/tasks.rb +3 -3
  32. data/lib/pg_search/version.rb +1 -1
  33. data/lib/pg_search.rb +5 -5
  34. data/pg_search.gemspec +16 -24
  35. data/spec/.rubocop.yml +20 -7
  36. data/spec/integration/.rubocop.yml +11 -0
  37. data/spec/integration/associations_spec.rb +121 -160
  38. data/spec/integration/deprecation_spec.rb +7 -8
  39. data/spec/integration/pg_search_spec.rb +390 -332
  40. data/spec/integration/single_table_inheritance_spec.rb +5 -5
  41. data/spec/lib/pg_search/configuration/association_spec.rb +21 -19
  42. data/spec/lib/pg_search/configuration/column_spec.rb +13 -1
  43. data/spec/lib/pg_search/configuration/foreign_column_spec.rb +4 -4
  44. data/spec/lib/pg_search/features/dmetaphone_spec.rb +4 -4
  45. data/spec/lib/pg_search/features/trigram_spec.rb +32 -28
  46. data/spec/lib/pg_search/features/tsearch_spec.rb +57 -33
  47. data/spec/lib/pg_search/multisearch/rebuilder_spec.rb +94 -63
  48. data/spec/lib/pg_search/multisearch_spec.rb +57 -29
  49. data/spec/lib/pg_search/multisearchable_spec.rb +160 -107
  50. data/spec/lib/pg_search/normalizer_spec.rb +12 -10
  51. data/spec/lib/pg_search_spec.rb +75 -64
  52. data/spec/spec_helper.rb +21 -9
  53. data/spec/support/database.rb +10 -8
  54. metadata +20 -134
  55. data/.autotest +0 -5
  56. data/.codeclimate.yml +0 -17
  57. data/.rubocop.yml +0 -56
  58. data/.travis.yml +0 -50
@@ -1,13 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'rake'
4
- require 'pg_search'
3
+ require "rake"
4
+ require "pg_search"
5
5
 
6
6
  namespace :pg_search do
7
7
  namespace :multisearch do
8
8
  desc "Rebuild PgSearch multisearch records for a given model"
9
9
  task :rebuild, %i[model schema] => :environment do |_task, args|
10
- raise ArgumentError, <<-MESSAGE.strip_heredoc unless args.model
10
+ raise ArgumentError, <<~MESSAGE unless args.model
11
11
 
12
12
  You must pass a model as an argument.
13
13
  Example: rake pg_search:multisearch:rebuild[BlogPost]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PgSearch
4
- VERSION = '2.3.2'
4
+ VERSION = "2.3.7"
5
5
  end
data/lib/pg_search.rb CHANGED
@@ -18,7 +18,7 @@ module PgSearch
18
18
  autoload :Document, "pg_search/document"
19
19
 
20
20
  def self.included(base)
21
- ActiveSupport::Deprecation.warn <<-MESSAGE.strip_heredoc
21
+ warn(<<~MESSAGE, category: :deprecated, uplevel: 1)
22
22
  Directly including `PgSearch` into an Active Record model is deprecated and will be removed in pg_search 3.0.
23
23
 
24
24
  Please replace `include PgSearch` with `include PgSearch::Model`.
@@ -34,8 +34,8 @@ module PgSearch
34
34
  self.unaccent_function = "unaccent"
35
35
 
36
36
  class << self
37
- def multisearch(*args)
38
- PgSearch::Document.search(*args)
37
+ def multisearch(...)
38
+ PgSearch::Document.search(...)
39
39
  end
40
40
 
41
41
  def disable_multisearch
@@ -57,14 +57,14 @@ module PgSearch
57
57
  class PgSearchRankNotSelected < StandardError
58
58
  def message
59
59
  "You must chain .with_pg_search_rank after the pg_search_scope " \
60
- "to access the pg_search_rank attribute on returned records"
60
+ "to access the pg_search_rank attribute on returned records"
61
61
  end
62
62
  end
63
63
 
64
64
  class PgSearchHighlightNotSelected < StandardError
65
65
  def message
66
66
  "You must chain .with_pg_search_highlight after the pg_search_scope " \
67
- "to access the pg_search_highlight attribute on returned records"
67
+ "to access the pg_search_highlight attribute on returned records"
68
68
  end
69
69
  end
70
70
  end
data/pg_search.gemspec CHANGED
@@ -1,33 +1,25 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- $LOAD_PATH.push File.expand_path('lib', __dir__)
4
- require 'pg_search/version'
3
+ $LOAD_PATH.push File.expand_path("lib", __dir__)
4
+ require "pg_search/version"
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = 'pg_search'
8
- s.version = PgSearch::VERSION
9
- s.platform = Gem::Platform::RUBY
10
- s.authors = ['Grant Hutchins', 'Case Commons, LLC']
11
- s.email = %w[gems@nertzy.com casecommons-dev@googlegroups.com]
12
- s.homepage = 'https://github.com/Casecommons/pg_search'
13
- s.summary = "PgSearch builds Active Record named scopes that take advantage of PostgreSQL's full text search"
7
+ s.name = "pg_search"
8
+ s.version = PgSearch::VERSION
9
+ s.platform = Gem::Platform::RUBY
10
+ s.authors = ["Grant Hutchins", "Case Commons, LLC"]
11
+ s.email = %w[gems@nertzy.com casecommons-dev@googlegroups.com]
12
+ s.homepage = "https://github.com/Casecommons/pg_search"
13
+ s.summary = "PgSearch builds Active Record named scopes that take advantage of PostgreSQL's full text search"
14
14
  s.description = "PgSearch builds Active Record named scopes that take advantage of PostgreSQL's full text search"
15
- s.licenses = ['MIT']
15
+ s.licenses = ["MIT"]
16
+ s.metadata["rubygems_mfa_required"] = "true"
16
17
 
17
- s.files = `git ls-files`.split("\n")
18
- s.test_files = `git ls-files -- spec/*`.split("\n")
19
- s.require_paths = ['lib']
18
+ s.files = `git ls-files -z`.split("\x0")
19
+ s.require_paths = ["lib"]
20
20
 
21
- s.add_dependency 'activerecord', '>= 5.2'
22
- s.add_dependency 'activesupport', '>= 5.2'
21
+ s.add_dependency "activerecord", ">= 6.1"
22
+ s.add_dependency "activesupport", ">= 6.1"
23
23
 
24
- s.add_development_dependency 'pry'
25
- s.add_development_dependency 'rake'
26
- s.add_development_dependency 'rspec', '>= 3.3'
27
- s.add_development_dependency 'rubocop', '>= 0.78.0'
28
- s.add_development_dependency 'rubocop-performance'
29
- s.add_development_dependency 'simplecov'
30
- s.add_development_dependency 'with_model', '>= 1.2'
31
-
32
- s.required_ruby_version = '>= 2.4'
24
+ s.required_ruby_version = ">= 3.0"
33
25
  end
data/spec/.rubocop.yml CHANGED
@@ -1,14 +1,27 @@
1
1
  inherit_from:
2
2
  - ../.rubocop.yml
3
3
 
4
- Layout/LineLength:
5
- Enabled: false
4
+ RSpec/ContextWording:
5
+ Prefixes:
6
+ - using
7
+ - via
8
+ - when
9
+ - with
10
+ - without
6
11
 
7
- Lint/SuppressedException:
8
- Enabled: false
12
+ RSpec/DescribedClass:
13
+ Enabled: true
9
14
 
10
- Lint/UselessAssignment:
11
- Enabled: false
15
+ RSpec/ExampleLength:
16
+ Max: 15
12
17
 
13
- Style/BlockDelimiters:
18
+ RSpec/ExpectInHook:
14
19
  Enabled: false
20
+
21
+ RSpec/FilePath:
22
+ CustomTransform:
23
+ TSearch: "tsearch"
24
+ DMetaphone: "dmetaphone"
25
+
26
+ RSpec/MultipleExpectations:
27
+ Max: 5
@@ -0,0 +1,11 @@
1
+ inherit_from:
2
+ - ../.rubocop.yml
3
+
4
+ RSpec/DescribeClass:
5
+ Enabled: false
6
+
7
+ RSpec/ExampleLength:
8
+ Enabled: false
9
+
10
+ RSpec/MultipleExpectations:
11
+ Enabled: false