pg_search 2.3.4 → 2.3.5

This diff has not been reviewed by any users.
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a217bfd36241c2a3b7e9d496fbcafcda084f0ab87c50baaee487ed3ad1349774
4
- data.tar.gz: 2adb9c974d6b1d00fbf89be865c1901e759de8956daa8b5795407a51468abc6e
3
+ metadata.gz: c2c29f81bcee1e1547d17ae1eda7c5a71e1f43d4891cc1e66ec8e7f648473698
4
+ data.tar.gz: 68e7d896513f774004f9259fcc2aa88cb6fc687783be02bd9abbb21466e6c989
5
5
  SHA512:
6
- metadata.gz: 16e3c8d3a801a3e2cee0a38b42de4ce5d74142c08be3908fbc733b591312047df33e4ec0101d7e2029646d4476d9875146d64bed90cb3492bd921967462eee01
7
- data.tar.gz: 0d5507703452f0b8607d2bb3ea355375ab88dcbf99fdc8239fe0a255820ad782e3d7ecd9101f28bde9f2df2c092aa323cb1c7d23c6460bd967b070efde4a33a8
6
+ metadata.gz: b1a224c8783e84a25aea02720ab06cb191c9a175c2416a9a1584e4a088845bc9b4d5e6a80eb73d06b7f4cabd933c770f386131b9cd52988626f200954770fa5b
7
+ data.tar.gz: 0744e0552c490b4e334334a23044d19aeae2cea28106fe09528add0a91c80bd9c7f507acb7a3c017df5d375cbf1a7bf590f6cb405ba066b8e4cc13b99f19904d
@@ -0,0 +1 @@
1
+ debug.fullTrace=true
@@ -102,7 +102,7 @@ RSpec/ExpectInHook:
102
102
  Enabled: false
103
103
 
104
104
  RSpec/FilePath:
105
- CustomTransform:
105
+ CustomTransform:
106
106
  TSearch: "tsearch"
107
107
  DMetaphone: "dmetaphone"
108
108
 
@@ -130,8 +130,5 @@ Style/RedundantRegexpEscape:
130
130
  RSpec/MultipleExpectations:
131
131
  Max: 5
132
132
 
133
- RSpec/MultipleMemoizedHelpers:
134
- AllowSubject: true
135
-
136
133
  RSpec/ExampleLength:
137
134
  Max: 15
@@ -6,22 +6,28 @@ rvm:
6
6
  - 2.7.2
7
7
  - 2.6.6
8
8
  - 2.5.8
9
- - jruby-9.2.11.1
9
+ - jruby-9.2.13.0
10
+
11
+ services:
12
+ - postgresql
10
13
 
11
14
  env:
12
15
  global:
13
16
  - CC_TEST_REPORTER_ID=0a0e3e45118bc447e677d52c21d056a5471c4921d54f96ed7b2550d9fc5043ea
14
17
  matrix:
15
18
  - ACTIVE_RECORD_BRANCH="master"
19
+ - ACTIVE_RECORD_BRANCH="6-1-stable"
16
20
  - ACTIVE_RECORD_BRANCH="6-0-stable"
21
+ - ACTIVE_RECORD_VERSION="~> 6.1.0.rc1"
17
22
  - ACTIVE_RECORD_VERSION="~> 6.0.0"
18
23
  - ACTIVE_RECORD_VERSION="~> 5.2.0"
19
24
 
20
-
21
25
  matrix:
22
26
  allow_failures:
23
27
  - env: ACTIVE_RECORD_BRANCH="master"
24
28
  - env: ACTIVE_RECORD_BRANCH="6-0-stable"
29
+ - env: ACTIVE_RECORD_BRANCH="6-1-stable"
30
+ - env: ACTIVE_RECORD_VERSION="~> 6.1.0.rc1"
25
31
 
26
32
  before_script:
27
33
  - psql --version
@@ -34,9 +40,3 @@ script: bin/rake
34
40
 
35
41
  after_script:
36
42
  - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
37
-
38
- jdk:
39
- - openjdk8
40
-
41
- addons:
42
- postgresql: "9.6"
@@ -1,5 +1,10 @@
1
1
  # pg_search changelog
2
2
 
3
+ ## 2.3.5
4
+
5
+ * Add table of contents to README (Barry Woolgar)
6
+ * Add support for Active Record 6.1
7
+
3
8
  ## 2.3.4
4
9
 
5
10
  * Fix issue when setting various options directly on the `PgSearch` module while
@@ -0,0 +1,76 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, sex characteristics, gender identity and expression,
9
+ level of experience, education, socio-economic status, nationality, personal
10
+ appearance, race, religion, or sexual identity and orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at pg_search@nertzy.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72
+
73
+ [homepage]: https://www.contributor-covenant.org
74
+
75
+ For answers to common questions about this code of conduct, see
76
+ https://www.contributor-covenant.org/faq
data/README.md CHANGED
@@ -53,6 +53,47 @@ class Shape < ActiveRecord::Base
53
53
  end
54
54
  ```
55
55
 
56
+ ### Contents
57
+ * [Multi-search vs. search scopes](#multi-search-vs-search-scopes)
58
+ * [Multi-search](#multi-search)
59
+ * [Setup](#setup)
60
+ * [`multisearchable`](#multisearchable)
61
+ * [More Options ](#more-options)
62
+ * [Multi-search associations](#multi-search-associations)
63
+ * [Searching in the global search index](#searching-in-the-global-search-index)
64
+ * [Chaining method calls onto the results](#chaining-method-calls-onto-the-results)
65
+ * [Configuring multi-search](#configuring-multi-search)
66
+ * [Rebuilding search documents for a given class](#rebuilding-search-documents-for-a-given-class)
67
+ * [Disabling multi-search indexing temporarily](#disabling-multi-search-indexing-temporarily)
68
+ * [`pg_search_scope`](#pg_search_scope)
69
+ * [Searching against one column](#searching-against-one-column)
70
+ * [Searching against multiple columns](#searching-against-multiple-columns)
71
+ * [Dynamic search scopes](#dynamic-search-scopes)
72
+ * [Searching through associations](#searching-through-associations)
73
+ * [Searching using different search features](#searching-using-different-search-features)
74
+ * [`:tsearch` (Full Text Search)](#tsearch-full-text-search)
75
+ * [Weighting](#weighting)
76
+ * [`:prefix` (PostgreSQL 8.4 and newer only)](#prefix-postgresql-84-and-newer-only)
77
+ * [`:negation`](#negation)
78
+ * [`:dictionary`](#dictionary)
79
+ * [`:normalization`](#normalization)
80
+ * [`:any_word`](#any_word)
81
+ * [`:sort_only`](#sort_only)
82
+ * [`:highlight`](#highlight)
83
+ * [`:dmetaphone` (Double Metaphone soundalike search)](#dmetaphone-double-metaphone-soundalike-search)
84
+ * [`:trigram` (Trigram search)](#trigram-trigram-search)
85
+ * [`:threshold`](#threshold)
86
+ * [`:word_similarity`](#word_similarity)
87
+ * [Limiting Fields When Combining Features](#limiting-fields-when-combining-features)
88
+ * [Ignoring accent marks](#ignoring-accent-marks)
89
+ * [Using tsvector columns](#using-tsvector-columns)
90
+ * [Combining multiple tsvectors](#combining-multiple-tsvectors)
91
+ * [Configuring ranking and ordering](#configuring-ranking-and-ordering)
92
+ * [`:ranked_by` (Choosing a ranking algorithm)](#ranked_by-choosing-a-ranking-algorithm)
93
+ * [`:order_within_rank` (Breaking ties)](#order_within_rank-breaking-ties)
94
+ * [`PgSearch#pg_search_rank` (Reading a record's rank as a Float)](#pgsearchpg_search_rank-reading-a-records-rank-as-a-float)
95
+ * [Search rank and chained scopes](#search-rank-and-chained-scopes)
96
+
56
97
  ### Multi-search vs. search scopes
57
98
 
58
99
  pg_search supports two different techniques for searching, multi-search and
@@ -152,7 +152,7 @@ module PgSearch
152
152
  return scope if scope.included_modules.include?(PgSearchRankTableAliasing)
153
153
 
154
154
  scope.all.spawn.tap do |new_scope|
155
- new_scope.class_eval { include PgSearchRankTableAliasing }
155
+ new_scope.instance_eval { extend PgSearchRankTableAliasing }
156
156
  end
157
157
  end
158
158
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PgSearch
4
- VERSION = '2.3.4'
4
+ VERSION = '2.3.5'
5
5
  end
@@ -23,15 +23,15 @@ Gem::Specification.new do |s| # rubocop:disable Metrics/BlockLength
23
23
 
24
24
  s.add_development_dependency 'pry'
25
25
  s.add_development_dependency 'rake'
26
- s.add_development_dependency 'rspec', '>= 3.3'
27
- s.add_development_dependency 'rubocop', '>= 0.90.0'
26
+ s.add_development_dependency 'rspec'
27
+ s.add_development_dependency 'rubocop'
28
28
  s.add_development_dependency 'rubocop-performance'
29
29
  s.add_development_dependency 'rubocop-rails'
30
30
  s.add_development_dependency 'rubocop-rake'
31
31
  s.add_development_dependency 'rubocop-rspec'
32
32
  s.add_development_dependency 'simplecov'
33
33
  s.add_development_dependency 'warning'
34
- s.add_development_dependency 'with_model', '>= 1.2'
34
+ s.add_development_dependency 'with_model'
35
35
 
36
36
  s.required_ruby_version = '>= 2.5'
37
37
  end
@@ -205,9 +205,6 @@ describe PgSearch::Multisearch::Rebuilder do
205
205
 
206
206
  context "when :against includes non-column dynamic methods" do
207
207
  with_model :Model do
208
- table do
209
- end
210
-
211
208
  model do
212
209
  include PgSearch::Model
213
210
  multisearchable against: [:foo]
@@ -167,14 +167,13 @@ describe PgSearch::Multisearchable do
167
167
  end
168
168
 
169
169
  context "when searching against multiple columns" do
170
- let(:multisearchable_options) { { against: %i[attr1 attr2] } }
170
+ let(:multisearchable_options) { { against: %i[attr_1 attr_2] } }
171
171
 
172
172
  before do
173
173
  without_partial_double_verification do
174
- allow(record).to receive(:attr1).and_return('1')
175
- allow(record).to receive(:attr2).and_return('2')
174
+ allow(record).to receive(:attr_1).and_return('1')
175
+ allow(record).to receive(:attr_2).and_return('2')
176
176
  end
177
-
178
177
  record.save
179
178
  end
180
179
 
@@ -214,12 +213,12 @@ describe PgSearch::Multisearchable do
214
213
  end
215
214
 
216
215
  context "when searching against multiple columns" do
217
- let(:multisearchable_options) { { against: %i[attr1 attr2] } }
216
+ let(:multisearchable_options) { { against: %i[attr_1 attr_2] } }
218
217
 
219
218
  before do
220
219
  without_partial_double_verification do
221
- allow(record).to receive(:attr1).and_return('1')
222
- allow(record).to receive(:attr2).and_return('2')
220
+ allow(record).to receive(:attr_1).and_return('1')
221
+ allow(record).to receive(:attr_2).and_return('2')
223
222
  end
224
223
  record.save
225
224
  end
@@ -2,16 +2,14 @@
2
2
 
3
3
  require "spec_helper"
4
4
 
5
- # For AR 5 and greater, the association reflection's cache needs be cleared
5
+ # For Active Record 5.x and 6.0, the association reflection's cache needs be cleared
6
6
  # because we're stubbing the related constants.
7
- class << PgSearch::Document
8
- if ActiveRecord::VERSION::MAJOR >= 5
9
- def clear_searchable_cache
10
- reflect_on_association(:searchable).clear_association_scope_cache
11
- end
12
- else
13
- def clear_searchable_cache
14
- end
7
+ if ActiveRecord::VERSION::MAJOR == 5 || (ActiveRecord::VERSION::MAJOR == 6 && ActiveRecord::VERSION::MINOR == 0)
8
+ def clear_searchable_cache
9
+ PgSearch::Document.reflect_on_association(:searchable).clear_association_scope_cache
10
+ end
11
+ else
12
+ def clear_searchable_cache
15
13
  end
16
14
  end
17
15
 
@@ -35,7 +33,7 @@ describe PgSearch do
35
33
 
36
34
  context "with PgSearch.multisearch_options set to a Hash" do
37
35
  subject do
38
- PgSearch::Document.clear_searchable_cache
36
+ clear_searchable_cache
39
37
  described_class.multisearch(query).map(&:searchable)
40
38
  end
41
39
 
@@ -59,7 +57,7 @@ describe PgSearch do
59
57
 
60
58
  context "with PgSearch.multisearch_options set to a Proc" do
61
59
  subject do
62
- PgSearch::Document.clear_searchable_cache
60
+ clear_searchable_cache
63
61
  described_class.multisearch(query, soundalike).map(&:searchable)
64
62
  end
65
63
 
@@ -168,7 +166,7 @@ describe PgSearch do
168
166
 
169
167
  PgSearch::Multisearch.rebuild(SearchableSubclassModel)
170
168
 
171
- PgSearch::Document.clear_searchable_cache
169
+ clear_searchable_cache
172
170
  expect(PgSearch::Document.count).to be 1
173
171
  expect(PgSearch::Document.first.searchable.class).to be SearchableSubclassModel
174
172
  expect(PgSearch::Document.first.searchable).to eq expected
@@ -183,7 +181,7 @@ describe PgSearch do
183
181
  PgSearch::Multisearch.rebuild(SearchableSubclassModel)
184
182
  expect(PgSearch::Document.count).to be 2
185
183
 
186
- PgSearch::Document.clear_searchable_cache
184
+ clear_searchable_cache
187
185
  classes = PgSearch::Document.all.collect { |d| d.searchable.class }
188
186
  expect(classes).to include SearchableSubclassModel
189
187
  expect(classes).to include AnotherSearchableSubclassModel
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.4
4
+ version: 2.3.5
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: 2020-10-10 00:00:00.000000000 Z
12
+ date: 2020-11-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
@@ -73,28 +73,28 @@ dependencies:
73
73
  requirements:
74
74
  - - ">="
75
75
  - !ruby/object:Gem::Version
76
- version: '3.3'
76
+ version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
81
  - - ">="
82
82
  - !ruby/object:Gem::Version
83
- version: '3.3'
83
+ version: '0'
84
84
  - !ruby/object:Gem::Dependency
85
85
  name: rubocop
86
86
  requirement: !ruby/object:Gem::Requirement
87
87
  requirements:
88
88
  - - ">="
89
89
  - !ruby/object:Gem::Version
90
- version: 0.90.0
90
+ version: '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.90.0
97
+ version: '0'
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: rubocop-performance
100
100
  requirement: !ruby/object:Gem::Requirement
@@ -185,14 +185,14 @@ dependencies:
185
185
  requirements:
186
186
  - - ">="
187
187
  - !ruby/object:Gem::Version
188
- version: '1.2'
188
+ version: '0'
189
189
  type: :development
190
190
  prerelease: false
191
191
  version_requirements: !ruby/object:Gem::Requirement
192
192
  requirements:
193
193
  - - ">="
194
194
  - !ruby/object:Gem::Version
195
- version: '1.2'
195
+ version: '0'
196
196
  description: PgSearch builds Active Record named scopes that take advantage of PostgreSQL's
197
197
  full text search
198
198
  email:
@@ -208,10 +208,12 @@ files:
208
208
  - ".editorconfig"
209
209
  - ".github/dependabot.yml"
210
210
  - ".gitignore"
211
+ - ".jrubyrc"
211
212
  - ".rspec"
212
213
  - ".rubocop.yml"
213
214
  - ".travis.yml"
214
215
  - CHANGELOG.md
216
+ - CODE_OF_CONDUCT.md
215
217
  - CONTRIBUTING.md
216
218
  - Gemfile
217
219
  - LICENSE
@@ -285,7 +287,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
285
287
  - !ruby/object:Gem::Version
286
288
  version: '0'
287
289
  requirements: []
288
- rubygems_version: 3.1.2
290
+ rubygems_version: 3.1.4
289
291
  signing_key:
290
292
  specification_version: 4
291
293
  summary: PgSearch builds Active Record named scopes that take advantage of PostgreSQL's