pg_search 2.3.0 → 2.3.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c8e6c02c032d2a7a39ebe47e50584410cebe923e868dc6be720af23cd3748e55
4
- data.tar.gz: 24d70a673be8c9993c007b812af1d9af89cc565dfbbae9ed37c205d90ca893da
3
+ metadata.gz: 8f13cb418b0d27e5136ca3f62d70e67e43ca8c9917ec35415fb142096f415ef0
4
+ data.tar.gz: 31d34f5408bdda3131920bf1daa9e8f3204c47ba1edfc867d8926d4f32bc5800
5
5
  SHA512:
6
- metadata.gz: 06e43bdc63bd98ea57943068cde6723780000ca3765a016d9baecdac3eea7006a1deae35885654b88b4752e3ad6f136190ac8602ffad62b3aac356425fad66d0
7
- data.tar.gz: 500d85f688710b48bf235eb1765c66e569dd7db98d95f03eaa81242f12c746d2ce8a57176185700c8d1b6ca903039d2c9b42fd5b71c84a8e4f8c46d7ef3464f7
6
+ metadata.gz: 794064f36a7a6ebbea348273fb64fcf429a9d0ab44e0da83338858925ba8f311da348b259a3b447bbdc63ebf7da40dd87ee1bc8ef7e1b637aa3f77b264444099
7
+ data.tar.gz: 4b5b80dc6964fede4e29e22ec34c0bdf20db9719e7f9ca8d094de11d60eb5b2937163a0d466de9c103e454bfc1cbf886ba62269cd240eed1d2b8469154e76b09
@@ -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"
@@ -9,7 +9,7 @@ AllCops:
9
9
  Style/StringLiterals:
10
10
  Enabled: false
11
11
 
12
- Metrics/LineLength:
12
+ Layout/LineLength:
13
13
  Max: 120
14
14
 
15
15
  Metrics/MethodLength:
@@ -19,7 +19,7 @@ Metrics/BlockLength:
19
19
  Exclude:
20
20
  - spec/**/*
21
21
 
22
- Layout/AlignParameters:
22
+ Layout/ParameterAlignment:
23
23
  EnforcedStyle: with_fixed_indentation
24
24
 
25
25
  Style/NumericPredicate:
@@ -45,7 +45,7 @@ Bundler/DuplicatedGem:
45
45
  Style/EmptyMethod:
46
46
  EnforcedStyle: expanded
47
47
 
48
- Layout/IndentFirstArrayElement:
48
+ Layout/FirstArrayElementIndentation:
49
49
  EnforcedStyle: consistent
50
50
 
51
51
  Style/Documentation:
@@ -1,38 +1,34 @@
1
1
  language: ruby
2
- sudo: false
3
2
  bundler_args: --binstubs
4
3
  cache: bundler
5
4
 
6
5
  rvm:
7
- - 2.6.3
8
- - 2.5.5
9
- - 2.4.6
10
- - jruby-9.2.6.0
6
+ - 2.6.5
7
+ - 2.5.7
8
+ - 2.4.9
9
+ - jruby-9.2.8.0
11
10
 
12
11
  env:
13
12
  global:
14
13
  - CC_TEST_REPORTER_ID=0a0e3e45118bc447e677d52c21d056a5471c4921d54f96ed7b2550d9fc5043ea
15
14
  matrix:
16
15
  - ACTIVE_RECORD_BRANCH="master"
17
- - ACTIVE_RECORD_BRANCH="5-2-stable"
18
- - ACTIVE_RECORD_VERSION="~> 6.0.0.beta1"
16
+ - ACTIVE_RECORD_BRANCH="6-0-stable"
17
+ - ACTIVE_RECORD_VERSION="~> 6.0.0"
19
18
  - ACTIVE_RECORD_VERSION="~> 5.2.0"
20
- - ACTIVE_RECORD_VERSION="~> 5.1.0"
21
- - ACTIVE_RECORD_VERSION="~> 5.0.0"
22
- - ACTIVE_RECORD_VERSION="~> 4.2.9"
19
+
23
20
 
24
21
  matrix:
25
22
  allow_failures:
26
23
  - env: ACTIVE_RECORD_BRANCH="master"
27
- - env: ACTIVE_RECORD_BRANCH="5-2-stable"
28
- - env: ACTIVE_RECORD_VERSION="~> 6.0.0.beta1"
24
+ - env: ACTIVE_RECORD_BRANCH="6-0-stable"
29
25
  exclude:
30
- - rvm: 2.4.6
26
+ - rvm: 2.4.9
31
27
  env: ACTIVE_RECORD_BRANCH="master"
32
- - rvm: jruby-9.2.6.0
33
- env: ACTIVE_RECORD_VERSION="~> 4.2.9"
34
- - rvm: 2.4.5
35
- env: ACTIVE_RECORD_VERSION="~> 6.0.0.beta1"
28
+ - rvm: 2.4.9
29
+ env: ACTIVE_RECORD_VERSION="~> 6.0.0"
30
+ - rvm: 2.4.9
31
+ - env: ACTIVE_RECORD_BRANCH="6-0-stable"
36
32
 
37
33
  before_script:
38
34
  - psql --version
@@ -46,5 +42,8 @@ script: bin/rake
46
42
  after_script:
47
43
  - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
48
44
 
45
+ jdk:
46
+ - openjdk8
47
+
49
48
  addons:
50
49
  postgresql: "9.6"
@@ -1,5 +1,10 @@
1
1
  # pg_search changelog
2
2
 
3
+ ## 2.3.1
4
+
5
+ * Drop support for Active Record < 5.2
6
+ * Do not load railtie unless Rails::Railtie is defined, to avoid problem when loading alongside Action Mailer (Adam Schwartz)
7
+
3
8
  ## 2.3.0
4
9
 
5
10
  * Extract `PgSearch::Model` module
data/Gemfile CHANGED
@@ -4,7 +4,7 @@ source 'https://rubygems.org'
4
4
 
5
5
  gemspec
6
6
 
7
- gem 'pg', '>= 0.21.0', '< 1.0.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
10
  if ENV['ACTIVE_RECORD_BRANCH']
data/README.md CHANGED
@@ -17,7 +17,7 @@ Read the blog post introducing PgSearch at https://content.pivotal.io/blog/pg-se
17
17
  ## REQUIREMENTS
18
18
 
19
19
  * Ruby 2.4+
20
- * ActiveRecord 4.2+
20
+ * ActiveRecord 5.2+
21
21
  * PostgreSQL 9.2+
22
22
  * [PostgreSQL extensions](https://github.com/Casecommons/pg_search/wiki/Installing-PostgreSQL-Extensions) for certain features
23
23
 
@@ -175,15 +175,17 @@ multisearchable(
175
175
 
176
176
  **Specify additional attributes to be saved on the pg_search_documents table**
177
177
 
178
- You can specify `:additional_attributes` to be saved within the pg_search_documents table. For example, perhaps you are indexing a book model and an article model and wanted to include the author_id.
178
+ You can specify `:additional_attributes` to be saved within the `pg_search_documents` table. For example, perhaps you are indexing a book model and an article model and wanted to include the author_id.
179
179
 
180
- First, we need to add `author_id` to the migration creating our pg_search_documents table.
180
+ First, we need to add a reference to author to the migration creating our `pg_search_documents` table.
181
181
 
182
182
  ```ruby
183
183
  create_table :pg_search_documents do |t|
184
- t.text :content
185
- t.integer :author_id
186
- t.belongs_to :searchable, polymorphic: true, index: true
184
+ t.text :content
185
+ t.references :author, index: true
186
+ t.belongs_to :searchable, polymorphic: true, index: true
187
+ t.timestamps null: false
188
+ end
187
189
  ```
188
190
 
189
191
  Then, we can send in this additional attribute in a lambda
@@ -196,7 +198,10 @@ Then, we can send in this additional attribute in a lambda
196
198
  ```
197
199
 
198
200
  This allows much faster searches without joins later on by doing something like:
199
- `PgSearch.multisearch(params['search']).where(author_id: 2)`
201
+
202
+ ```ruby
203
+ PgSearch.multisearch(params['search']).where(author_id: 2)
204
+ ```
200
205
 
201
206
  *NOTE: You must currently manually call `record.update_pg_search_document` for the additional attribute to be included in the pg_search_documents table*
202
207
 
@@ -718,7 +723,7 @@ class Person < ActiveRecord::Base
718
723
  pg_search_scope :search,
719
724
  against: :name,
720
725
  using: {
721
- tsearch: {any_word: true}
726
+ tsearch: {any_word: true},
722
727
  dmetaphone: {any_word: true, sort_only: true}
723
728
  }
724
729
  end
@@ -1143,15 +1148,11 @@ Patterson](http://tenderlovemaking.com/) for the original version and to Caseboo
1143
1148
 
1144
1149
  ## CONTRIBUTIONS AND FEEDBACK
1145
1150
 
1146
- Welcomed! Feel free to join and contribute to our [public Pivotal Tracker
1147
- project](https://www.pivotaltracker.com/projects/228645) where we manage new
1148
- feature ideas and bugs.
1151
+ Please read our [CONTRIBUTING guide](https://github.com/Casecommons/pg_search/blob/master/CONTRIBUTING.md).
1149
1152
 
1150
1153
  We also have a [Google Group](http://groups.google.com/group/casecommons-dev)
1151
1154
  for discussing pg_search and other Casebook PBC open source projects.
1152
1155
 
1153
- Please read our [CONTRIBUTING guide](https://github.com/Casecommons/pg_search/blob/master/CONTRIBUTING.md).
1154
-
1155
1156
  ## LICENSE
1156
1157
 
1157
1158
  Copyright © 2010–2019 [Casebook PBC](http://www.casebook.net).
@@ -71,4 +71,4 @@ ActiveSupport.on_load(:active_record) do
71
71
  require "pg_search/document"
72
72
  end
73
73
 
74
- require "pg_search/railtie" if defined?(Rails)
74
+ require "pg_search/railtie" if defined?(Rails::Railtie)
@@ -12,6 +12,7 @@ namespace :pg_search do
12
12
  You must pass a model as an argument.
13
13
  Example: rake pg_search:multisearch:rebuild[BlogPost]
14
14
  MESSAGE
15
+
15
16
  model_class = args.model.classify.constantize
16
17
  connection = PgSearch::Document.connection
17
18
  original_schema_search_path = connection.schema_search_path
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PgSearch
4
- VERSION = '2.3.0'
4
+ VERSION = '2.3.1'
5
5
  end
@@ -18,13 +18,13 @@ Gem::Specification.new do |s|
18
18
  s.test_files = `git ls-files -- spec/*`.split("\n")
19
19
  s.require_paths = ['lib']
20
20
 
21
- s.add_dependency 'activerecord', '>= 4.2'
22
- s.add_dependency 'activesupport', '>= 4.2'
21
+ s.add_dependency 'activerecord', '>= 5.2'
22
+ s.add_dependency 'activesupport', '>= 5.2'
23
23
 
24
24
  s.add_development_dependency 'pry'
25
25
  s.add_development_dependency 'rake'
26
26
  s.add_development_dependency 'rspec', '>= 3.3'
27
- s.add_development_dependency 'rubocop', '>= 0.68.1'
27
+ s.add_development_dependency 'rubocop', '>= 0.78.0'
28
28
  s.add_development_dependency 'rubocop-performance'
29
29
  s.add_development_dependency 'simplecov'
30
30
  s.add_development_dependency 'with_model', '>= 1.2'
@@ -1,10 +1,10 @@
1
1
  inherit_from:
2
2
  - ../.rubocop.yml
3
3
 
4
- Metrics/LineLength:
4
+ Layout/LineLength:
5
5
  Enabled: false
6
6
 
7
- Lint/HandleExceptions:
7
+ Lint/SuppressedException:
8
8
  Enabled: false
9
9
 
10
10
  Lint/UselessAssignment:
@@ -2,11 +2,6 @@
2
2
 
3
3
  require "spec_helper"
4
4
 
5
- def has_microsecond_precision?
6
- (ActiveRecord::VERSION::MAJOR == 4 && ActiveRecord::VERSION::MINOR >= 1) ||
7
- (ActiveRecord::VERSION::MAJOR == 4 && ActiveRecord::VERSION::MINOR == 0 && ActiveRecord::VERSION::TINY >= 1)
8
- end
9
-
10
5
  describe PgSearch::Multisearch::Rebuilder do
11
6
  with_table "pg_search_documents", {}, &DOCUMENTS_SCHEMA
12
7
 
@@ -105,10 +100,6 @@ describe PgSearch::Multisearch::Rebuilder do
105
100
  time = Time.utc(2001, 1, 1, 0, 0, 0)
106
101
  rebuilder = PgSearch::Multisearch::Rebuilder.new(Model, -> { time })
107
102
 
108
- # Handle change in precision of Time objects in SQL in Active Record 4.0.1
109
- # https://github.com/rails/rails/commit/17f5d8e062909f1fcae25351834d8e89967b645e
110
- expected_timestamp = has_microsecond_precision? ? "2001-01-01 00:00:00.000000" : "2001-01-01 00:00:00"
111
-
112
103
  expected_sql = <<-SQL.strip_heredoc
113
104
  INSERT INTO "pg_search_documents" (searchable_type, searchable_id, content, created_at, updated_at)
114
105
  SELECT 'Model' AS searchable_type,
@@ -116,8 +107,8 @@ describe PgSearch::Multisearch::Rebuilder do
116
107
  (
117
108
  coalesce(#{Model.quoted_table_name}."name"::text, '')
118
109
  ) AS content,
119
- '#{expected_timestamp}' AS created_at,
120
- '#{expected_timestamp}' AS updated_at
110
+ '2001-01-01 00:00:00' AS created_at,
111
+ '2001-01-01 00:00:00' AS updated_at
121
112
  FROM #{Model.quoted_table_name}
122
113
  SQL
123
114
 
@@ -169,10 +160,6 @@ describe PgSearch::Multisearch::Rebuilder do
169
160
  time = Time.utc(2001, 1, 1, 0, 0, 0)
170
161
  rebuilder = PgSearch::Multisearch::Rebuilder.new(ModelWithNonStandardPrimaryKey, -> { time })
171
162
 
172
- # Handle change in precision of Time objects in SQL in Active Record 4.0.1
173
- # https://github.com/rails/rails/commit/17f5d8e062909f1fcae25351834d8e89967b645e
174
- expected_timestamp = has_microsecond_precision? ? "2001-01-01 00:00:00.000000" : "2001-01-01 00:00:00"
175
-
176
163
  expected_sql = <<-SQL.strip_heredoc
177
164
  INSERT INTO "pg_search_documents" (searchable_type, searchable_id, content, created_at, updated_at)
178
165
  SELECT 'ModelWithNonStandardPrimaryKey' AS searchable_type,
@@ -180,8 +167,8 @@ describe PgSearch::Multisearch::Rebuilder do
180
167
  (
181
168
  coalesce(#{ModelWithNonStandardPrimaryKey.quoted_table_name}."name"::text, '')
182
169
  ) AS content,
183
- '#{expected_timestamp}' AS created_at,
184
- '#{expected_timestamp}' AS updated_at
170
+ '2001-01-01 00:00:00' AS created_at,
171
+ '2001-01-01 00:00:00' AS updated_at
185
172
  FROM #{ModelWithNonStandardPrimaryKey.quoted_table_name}
186
173
  SQL
187
174
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg_search
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Grant Hutchins
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-07-13 00:00:00.000000000 Z
12
+ date: 2019-12-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
@@ -17,28 +17,28 @@ dependencies:
17
17
  requirements:
18
18
  - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: '4.2'
20
+ version: '5.2'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - ">="
26
26
  - !ruby/object:Gem::Version
27
- version: '4.2'
27
+ version: '5.2'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: activesupport
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
32
  - - ">="
33
33
  - !ruby/object:Gem::Version
34
- version: '4.2'
34
+ version: '5.2'
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - ">="
40
40
  - !ruby/object:Gem::Version
41
- version: '4.2'
41
+ version: '5.2'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: pry
44
44
  requirement: !ruby/object:Gem::Requirement
@@ -87,14 +87,14 @@ dependencies:
87
87
  requirements:
88
88
  - - ">="
89
89
  - !ruby/object:Gem::Version
90
- version: 0.68.1
90
+ version: 0.78.0
91
91
  type: :development
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
95
  - - ">="
96
96
  - !ruby/object:Gem::Version
97
- version: 0.68.1
97
+ version: 0.78.0
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: rubocop-performance
100
100
  requirement: !ruby/object:Gem::Requirement