mongoid_fulltext 0.8.2 → 0.9.0

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 (50) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/danger-comment.yml +19 -0
  3. data/.github/workflows/danger.yml +21 -0
  4. data/.github/workflows/lint.yml +29 -0
  5. data/.github/workflows/release.yml +30 -0
  6. data/.github/workflows/test.yml +81 -0
  7. data/.gitignore +2 -0
  8. data/.rubocop.yml +149 -3
  9. data/.rubocop_todo.yml +104 -59
  10. data/.spellcheck.txt +181 -0
  11. data/CHANGELOG.md +54 -33
  12. data/Dangerfile +5 -1
  13. data/Gemfile +22 -20
  14. data/Gemfile.danger +5 -0
  15. data/README.md +171 -178
  16. data/RELEASING.md +47 -30
  17. data/Rakefile +21 -3
  18. data/UPGRADING.md +43 -0
  19. data/lib/mongoid/full_text_search/field_scores.rb +48 -0
  20. data/lib/mongoid/full_text_search/index_definition.rb +31 -0
  21. data/lib/mongoid/full_text_search/ngrams.rb +93 -0
  22. data/lib/mongoid/full_text_search/version.rb +1 -1
  23. data/lib/mongoid/full_text_search.rb +94 -125
  24. data/mongoid_fulltext.gemspec +2 -3
  25. data/script/release.rb +13 -0
  26. data/spec/models/chinese_artwork.rb +7 -0
  27. data/spec/models/localized_artwork.rb +29 -0
  28. data/spec/models/multilingual_artwork.rb +7 -0
  29. data/spec/models/russian_artwork.rb +0 -1
  30. data/spec/models/scoped_artwork.rb +14 -0
  31. data/spec/models/tagged_artwork.rb +9 -0
  32. data/spec/models/weighted_artwork.rb +34 -0
  33. data/spec/mongoid/array_fields_spec.rb +43 -0
  34. data/spec/mongoid/bulk_indexing_spec.rb +56 -0
  35. data/spec/mongoid/candidate_limits_spec.rb +19 -0
  36. data/spec/mongoid/criteria_search_spec.rb +73 -0
  37. data/spec/mongoid/full_text_search_spec.rb +31 -6
  38. data/spec/mongoid/localized_fields_spec.rb +197 -0
  39. data/spec/mongoid/ngram_sampling_spec.rb +55 -0
  40. data/spec/mongoid/non_latin_spec.rb +50 -0
  41. data/spec/mongoid/timeout_option_spec.rb +18 -0
  42. data/spec/mongoid/weighted_fields_spec.rb +102 -0
  43. data/spec/release/release_spec.rb +60 -0
  44. data/spec/spec_helper.rb +15 -3
  45. data/spec/unit/field_scores_spec.rb +54 -0
  46. data/spec/unit/index_definition_spec.rb +48 -0
  47. data/spec/unit/ngrams_spec.rb +73 -0
  48. data/spec/version_spec.rb +7 -0
  49. metadata +41 -11
  50. data/.travis.yml +0 -33
data/.spellcheck.txt ADDED
@@ -0,0 +1,181 @@
1
+ aaa
2
+ aaaa
3
+ AaronH
4
+ aaw
5
+ abc
6
+ abcd
7
+ abcde
8
+ abcdef
9
+ abcdefg
10
+ abcdefgh
11
+ abcdefghij
12
+ abcdefghijk
13
+ abcdefghijklmnopqrstuvwxyz
14
+ AccentlessArtwork
15
+ Addeda
16
+ AdvancedArtwork
17
+ allowlist
18
+ allowlists
19
+ andy
20
+ AndyPicasso
21
+ APIs
22
+ arg
23
+ autocomplete
24
+ barfoo
25
+ BasicArtwork
26
+ baz
27
+ bcd
28
+ Bundler
29
+ caf
30
+ CAFÉ
31
+ cd
32
+ cde
33
+ cesar
34
+ Cesky
35
+ cesky
36
+ chainable
37
+ CHANGELOG
38
+ changelog
39
+ ClassConstantName
40
+ claude
41
+ config
42
+ cOOkies
43
+ Cookilowers
44
+ Csar
45
+ cyrillic
46
+ César
47
+ Dadamaino
48
+ dadamaino
49
+ dama
50
+ dami
51
+ damien
52
+ dblock
53
+ dbussink
54
+ defg
55
+ Dimethyl
56
+ downcase
57
+ downcasing
58
+ efg
59
+ Eg
60
+ english
61
+ ethul
62
+ é
63
+ fallbacks
64
+ fgh
65
+ FilteredArtist
66
+ FilteredArtwork
67
+ Floweockies
68
+ fLOWER
69
+ Fu
70
+ Fulltext
71
+ fulltext
72
+ FullTextSearch
73
+ Galicia
74
+ Gemfile
75
+ gemspec
76
+ ghi
77
+ Gogh
78
+ hij
79
+ hijklmn
80
+ Hirst
81
+ ijk
82
+ inconsistet
83
+ JK
84
+ jk
85
+ joeyAghion
86
+ JRuby
87
+ kull
88
+ Kung
89
+ Kvetiny
90
+ kvetiny
91
+ latin
92
+ linter
93
+ lisa
94
+ localhost
95
+ lookups
96
+ lowercasing
97
+ lOWERED
98
+ mao
99
+ Maox
100
+ md
101
+ mona
102
+ monday
103
+ monet
104
+ Mongo
105
+ mongo
106
+ Mongoid
107
+ mongoid
108
+ Mongoid's
109
+ MongoidFulltextRelease
110
+ Morehall
111
+ myfoo
112
+ mYTH
113
+ Nerian
114
+ netoneko
115
+ NFKD
116
+ Ngram
117
+ ngram
118
+ ngrams
119
+ nickhoffman
120
+ nomatch
121
+ noninteger
122
+ Nonlocalized
123
+ nonlocalized
124
+ nonpositive
125
+ Obraz
126
+ obraz
127
+ ODM
128
+ oo
129
+ Oppenheim
130
+ ORM
131
+ pABLO
132
+ pablo
133
+ PabloWarhol
134
+ paox
135
+ pICASSO
136
+ picasso
137
+ Poppie
138
+ poppie
139
+ porehall
140
+ proc
141
+ Rakefile
142
+ rb
143
+ README
144
+ Readme
145
+ reindex
146
+ reindexed
147
+ reindexing
148
+ rgb
149
+ roykolak
150
+ RSpec
151
+ RuboCop
152
+ rubocop
153
+ RubyGems
154
+ RussianArtwork
155
+ Schmoe
156
+ Shishkin
157
+ shishkin
158
+ simi
159
+ SimpleCov
160
+ Somao
161
+ steverandy
162
+ stopword
163
+ Stopwords
164
+ stopwords
165
+ th
166
+ there're
167
+ tomasc
168
+ unconfigured
169
+ unescape
170
+ unscoped
171
+ untagged
172
+ UTF
173
+ vangogh
174
+ vince
175
+ volmer
176
+ warho
177
+ wArHoL
178
+ warhol
179
+ YAML
180
+ Yan
181
+ zepplock
data/CHANGELOG.md CHANGED
@@ -1,135 +1,156 @@
1
- ### 0.8.1 (Next)
1
+ ### 0.9.0 (2026/11/24)
2
+
3
+ * [#75](https://github.com/mongoid/mongoid_fulltext/pull/75): Ignore `vendor/bundle` so the release workflow's clean-checkout check passes after `bundler-cache` installs gems - [@dblock](https://github.com/dblock).
4
+ * [#71](https://github.com/mongoid/mongoid_fulltext/pull/71): Release with ruby-gem-release from a manually dispatched GitHub Actions workflow using RubyGems Trusted Publishing, with dry runs - [@dblock](https://github.com/dblock).
5
+ * [#70](https://github.com/mongoid/mongoid_fulltext/pull/70): Fix scoped searches ignoring criteria on document ids with Mongoid 7.0 and older - [@dblock](https://github.com/dblock).
6
+ * [#68](https://github.com/mongoid/mongoid_fulltext/pull/68): Cover candidate-budget boundaries and combine coverage from actual legacy and modern drivers - [@dblock](https://github.com/dblock).
7
+ * [#61](https://github.com/mongoid/mongoid_fulltext/pull/61): Support weighted fields with configurable maximum or summed field-score aggregation - [@dblock](https://github.com/dblock).
8
+ * [#60](https://github.com/mongoid/mongoid_fulltext/pull/60): Extract ngram calculation and index-definition planning for maintainability without changing model APIs or search behavior - [@tomasc](https://github.com/tomasc), [@dblock](https://github.com/dblock).
9
+ * [#59](https://github.com/mongoid/mongoid_fulltext/pull/59): Document and cover class-level indexing timeout options - [@dblock](https://github.com/dblock).
10
+ * [#52](https://github.com/mongoid/mongoid_fulltext/pull/52): Fix full-text index creation before any documents exist - [@dblock](https://github.com/dblock).
11
+ * [#58](https://github.com/mongoid/mongoid_fulltext/pull/58): Support localized fields with locale-tagged ngrams in one index collection; existing localized indexes must be rebuilt - [@tomasc](https://github.com/tomasc), [@dblock](https://github.com/dblock).
12
+ * [#57](https://github.com/mongoid/mongoid_fulltext/pull/57): Respect criteria and single-collection inheritance, skip dangling references, and apply result limits after filtering - [@tomasc](https://github.com/tomasc), [@dblock](https://github.com/dblock).
13
+ * [#56](https://github.com/mongoid/mongoid_fulltext/pull/56): Support Unicode-aware regular expressions for alphabets without enumerating characters - [@dblock](https://github.com/dblock).
14
+ * [#54](https://github.com/mongoid/mongoid_fulltext/pull/54): Insert ngrams in a batch per document index and continue past empty indexes - [@dblock](https://github.com/dblock).
15
+ * [#53](https://github.com/mongoid/mongoid_fulltext/pull/53): Support indexing array fields containing strings - [@dblock](https://github.com/dblock).
16
+ * [#55](https://github.com/mongoid/mongoid_fulltext/pull/55): Correct query ngram sampling to respect the configured limit and cover both ends of the query - [@dblock](https://github.com/dblock).
17
+ * [#51](https://github.com/mongoid/mongoid_fulltext/pull/51): Modernize CI through Ruby 4.0, Mongoid 9, and MongoDB 8 with real coverage, RuboCop 1.92, and fork-safe Danger workflows - [@dblock](https://github.com/dblock).
18
+ * [#45](https://github.com/mongoid/mongoid_fulltext/pull/45): Allow for class level ngram updates to not timeout - [@roykolak](https://github.com/roykolak).
19
+ * [#77](https://github.com/mongoid/mongoid_fulltext/pull/77): Upgrade danger-pr-comment to 0.3.0 from the `danger` organization and skip empty Danger report comments - [@dblock](https://github.com/dblock).
20
+ * [#72](https://github.com/mongoid/mongoid_fulltext/pull/72): Lint Markdown, YAML, and spelling with rubocop-md, rubocop-prose, rubocop-spellcheck, and rubocop-yaml in a separate Lint workflow, and clean up documentation - [@dblock](https://github.com/dblock).
21
+ * [#73](https://github.com/mongoid/mongoid_fulltext/pull/73): Run CI pushes only on the default branch, cancel superseded pull request runs, skip duplicate lint in the test matrix, and bound job times - [@dblock](https://github.com/dblock).
22
+
23
+ ### 0.8.2 (2018/08/05)
2
24
 
3
25
  * [#35](https://github.com/mongoid/mongoid_fulltext/pull/35): Mongoid 7 compatibility - [@tomasc](https://github.com/tomasc).
4
- * Your contribution here.
5
26
 
6
- ### 0.8.0 (1/19/2017)
27
+ ### 0.8.0 (2017/01/19)
7
28
 
8
29
  * [#28](https://github.com/mongoid/mongoid_fulltext/pull/28): Moved to the mongoid organization - [@dblock](https://github.com/dblock).
9
30
  * [#28](https://github.com/mongoid/mongoid_fulltext/pull/29): Compatibility with Mongoid 6 - [@dblock](https://github.com/dblock).
10
31
  * [#28](https://github.com/mongoid/mongoid_fulltext/pull/28): Only testing on Ruby 2.3.1 and MongoDB 3.2 - [@dblock](https://github.com/dblock).
11
32
  * [#31](https://github.com/mongoid/mongoid_fulltext/pull/31): Added danger, PR linter - [@dblock](https://github.com/dblock).
12
33
 
13
- ### 0.7.1 (11/18/2015)
34
+ ### 0.7.1 (2015/11/18)
14
35
 
15
36
  * [#24](https://github.com/mongoid/mongoid_fulltext/pull/24): Fix: `undefined method 'create_indexes' for module 'Mongoid::Indexable::ClassMethods'` - [@dblock](https://github.com/dblock).
16
37
 
17
- ### 0.7.0 (9/18/2015)
38
+ ### 0.7.0 (2015/09/18)
18
39
 
19
40
  * Compatible with Mongoid 4 and 5 - [@dblock](https://github.com/dblock).
20
41
  * Rewritten .gemspec, removed Jeweler - [@dblock](https://github.com/dblock).
21
42
  * Added RuboCop - [@dblock](https://github.com/dblock).
22
43
 
23
- ### 0.6.1 (4/3/2013)
44
+ ### 0.6.1 (2013/04/03)
24
45
 
25
46
  * [#6](https://github.com/mongoid/mongoid_fulltext/pull/6): Upgrade to Mongoid ~> 3.0 - [@simi](https://github.com/simi).
26
47
 
27
- ### 0.6.0 (7/16/2012)
48
+ ### 0.6.0 (2012/07/16)
28
49
 
29
50
  * [#2](https://github.com/mongoid/mongoid_fulltext/pull/2): Upgrade to Mongoid 3.0 - [@volmer](https://github.com/volmer).
30
51
  * [#1](https://github.com/mongoid/mongoid_fulltext/pull/1): Fix: downcase destroys non-latin strings - [@netoneko](https://github.com/netoneko).
31
52
 
32
- ### 0.5.8 (3/8/2012)
53
+ ### 0.5.8 (2012/03/08)
33
54
 
34
55
  * Fix: do not CGI.unescape inside fulltext search - [@dblock](https://github.com/dblock).
35
56
  * Refactored array filter API, allowing for overriding filter query method - [@ethul](https://github.com/ethul).
36
57
  * Fix: check for the existence of the Mongoid.logger before calling it in case it was configured to false - [@AaronH](https://github.com/AaronH).
37
58
  * Added install instructions to Readme - [@Nerian](https://github.com/Nerian).
38
59
 
39
- ### 0.5.7 (1/11/2012)
60
+ ### 0.5.7 (2012/01/11)
40
61
 
41
62
  * Added `reindex_immediately` option to suppress automatic reindexing - [@joeyAghion](https://github.com/joeyAghion).
42
63
  * Fix: treatment of word separators, adding newlines, tabs and dashes into the set of default word separators - [@aaw](https://github.com/aaw).
43
64
 
44
- ### 0.5.4 (11/8/2011)
65
+ ### 0.5.4 (2011/11/08)
45
66
 
46
67
  * Made full word and prefix bumps inversely proportional to the length of the string - [@aaw](https://github.com/aaw).
47
68
 
48
- ### 0.5.3 (11/8/2011)
69
+ ### 0.5.3 (2011/11/08)
49
70
 
50
71
  * Added an option to index short prefixes of words - [@aaw](https://github.com/aaw).
51
72
 
52
- ### 0.5.2 (11/5/2011)
73
+ ### 0.5.2 (2011/11/05)
53
74
 
54
75
  * Added the ability to index full words that are less than the ngram length and not stop words - [@aaw](https://github.com/aaw).
55
76
 
56
- ### 0.5.1 (11/2/2011)
77
+ ### 0.5.1 (2011/11/02)
57
78
 
58
79
  * Reducing the score for a full-word match (these used to be counted multiple times for multiple occurrences) and adding a list of stopwords to the config. Stopwords aren't given a score boost when matched as full words - [@aaw](https://github.com/aaw).
59
80
  * Added UTF8 downcasing - [@zepplock](https://github.com/zepplock).
60
81
 
61
- ### 0.5.0 (10/11/2011)
82
+ ### 0.5.0 (2011/10/11)
62
83
 
63
84
  * Fix: inconsistet scoring words with the same length as the ngram length - [@aaw](https://github.com/aaw).
64
85
 
65
- ### 0.4.5 (10/5/2011)
86
+ ### 0.4.5 (2011/10/05)
66
87
 
67
88
  * Added `update_if` config option to control when index updates occur - [@nickhoffman](https://github.com/nickhoffman).
68
89
 
69
- ### 0.4.4 (8/31/2011)
90
+ ### 0.4.4 (2011/08/31)
70
91
 
71
92
  * Added `remove_accents` - [@tdp2110](https://github.com/tdp2110).
72
93
 
73
- ### 0.4.3 (8/3/2011)
94
+ ### 0.4.3 (2011/08/03)
74
95
 
75
96
  * Fix: including `Mongoid::FulltextSearch` and not using it causes created_indexes to fail - [@dblock](https://github.com/dblock).
76
97
 
77
- ### 0.4.2 (6/28/2011)
98
+ ### 0.4.2 (2011/06/28)
78
99
 
79
100
  * Delay-creating indexes in sync with how Mongoid creates indexes on normal collections - [@dblock](https://github.com/dblock).
80
101
 
81
- ### 0.4.1 (6/27/2011)
102
+ ### 0.4.1 (2011/06/27)
82
103
 
83
104
  * Using `Mongoid.logger` for logging - [@dblock](https://github.com/dblock).
84
- * Changed `ensure_index` to index in the background, avoid blocking booting app - [@dblock](https://github.com/dblock).
105
+ * Changed `ensure_index` to index in the background, avoid blocking booting app - [@dblock](https://github.com/dblock).
85
106
 
86
- ### 0.4.0 (6/19/2011)
107
+ ### 0.4.0 (2011/06/19)
87
108
 
88
109
  * Removing all use of map-reduce - [@aaw](https://github.com/aaw).
89
110
  * Support class name with module for example (Module::ClassConstantName) - [@steverandy](https://github.com/steverandy).
90
111
 
91
- ### 0.3.7 (6/7/2011)
112
+ ### 0.3.7 (2011/06/07)
92
113
 
93
- * Added support for updating model indexes in bulk - [@dblock](https://github.com/dblock).
114
+ * Added support for updating model indexes in bulk - [@dblock](https://github.com/dblock).
94
115
 
95
- ### 0.3.6 (5/27/2011)
116
+ ### 0.3.6 (2011/05/27)
96
117
 
97
118
  * Skipping words that are shorter than the n-gram - [@dblock](https://github.com/dblock).
98
119
  * Added `index_full_words` - [@dblock](https://github.com/dblock).
99
- * Keeping max score of ngram in the ngram hash - [@dblock](https://github.com/dblock).
120
+ * Keeping max score of ngram in the ngram hash - [@dblock](https://github.com/dblock).
100
121
 
101
- ### 0.3.5 (5/25/2011)
122
+ ### 0.3.5 (2011/05/25)
102
123
 
103
124
  * Added index on document_id for faster remove - [@dblock](https://github.com/dblock).
104
125
  * Addeda way to return scored results - [@dblock](https://github.com/dblock).
105
126
 
106
- ### 0.3.4 (5/16/2011)
127
+ ### 0.3.4 (2011/05/16)
107
128
 
108
129
  * Added support for array filters - [@dblock](https://github.com/dblock).
109
130
  * Added support for Ruby 1.8.7 - [@dbussink](https://github.com/dbussink).
110
131
 
111
- ### 0.3.2 (4/19/2011)
132
+ ### 0.3.2 (2011/04/19)
112
133
 
113
134
  * Exposing `update_ngram_index` and `remove_from_ngram_index` for fast bulk-updating the index - [@aaw](https://github.com/aaw).
114
135
 
115
- ### 0.3.1 (4/14/2011)
136
+ ### 0.3.1 (2011/04/14)
116
137
 
117
138
  * Support for mongo versions >= 1.7.4 - [@aaw](https://github.com/aaw).
118
139
 
119
- ### 0.3.0 (4/13/2011)
140
+ ### 0.3.0 (2011/04/13)
120
141
 
121
142
  * Adding the ability to define filters on an index - [@aaw](https://github.com/aaw).
122
143
 
123
- ### 0.2.0 (4/13/2011)
144
+ ### 0.2.0 (2011/04/13)
124
145
 
125
146
  * Multiple indexes per model, removing internal indexes entirely - [@aaw](https://github.com/aaw).
126
147
 
127
- ### 0.1.1 (4/11/2011)
148
+ ### 0.1.1 (2011/04/11)
128
149
 
129
150
  * Keep garbage in the index from blowing up `fulltext_search` - [@aaw](https://github.com/aaw).
130
151
  * Indexing the results of `to_s` if no fields are provided - [@aaw](https://github.com/aaw).
131
152
  * Adding a `before_destroy` callback for external indexes - [@aaw](https://github.com/aaw).
132
153
 
133
- ### 0.1.0 (4/7/2011)
154
+ ### 0.1.0 (2011/04/07)
134
155
 
135
156
  * Initial public release - [@aaw](https://github.com/aaw).
data/Dangerfile CHANGED
@@ -1 +1,5 @@
1
- danger.import_dangerfile(gem: 'mongoid-danger')
1
+ # frozen_string_literal: true
2
+
3
+ danger.import_dangerfile(gem: 'danger-pr-comment')
4
+
5
+ changelog.check!
data/Gemfile CHANGED
@@ -1,30 +1,32 @@
1
- source 'http://rubygems.org'
1
+ source 'https://rubygems.org'
2
2
 
3
- case version = ENV['MONGOID_VERSION'] || '7'
4
- when /7/
5
- gem 'mongoid', '~> 7.0'
6
- when /6/
7
- gem 'mongoid', '~> 6.0'
8
- when /5/
9
- gem 'mongoid', '~> 5.0'
10
- when /4/
11
- gem 'mongoid', '~> 4.0'
12
- when /3.1.0/
13
- gem 'mongoid', '~> 3.1.0'
14
- when /3.0.0/
15
- gem 'mongoid', '~> 3.0.0'
16
- else
17
- gem 'mongoid', version
18
- end
3
+ version = ENV['MONGOID_VERSION'] || '9'
4
+ gem 'bigdecimal' if RUBY_VERSION >= '3.4'
5
+ gem 'logger' if RUBY_VERSION >= '2.5'
6
+ gem 'mongoid', version =~ /\A\d+\z/ ? "~> #{version}.0" : version
19
7
 
20
8
  gemspec
21
9
 
22
10
  group :test do
11
+ if RUBY_VERSION >= '2.7'
12
+ gem 'database_cleaner-mongoid', '~> 2.0'
13
+ else
14
+ gem 'database_cleaner', '~> 1.8'
15
+ end
23
16
  gem 'rspec'
17
+ gem 'simplecov', RUBY_VERSION < '2.5' ? '~> 0.16.0' : '~> 0.22', require: false if ENV['COVERAGE'] == 'true'
24
18
  end
25
19
 
26
20
  group :development do
27
- gem 'mongoid-danger', '~> 0.1.1'
28
- gem 'rake', '< 11'
29
- gem 'rubocop', '~> 0.55'
21
+ gem 'rake'
22
+ if RUBY_ENGINE == 'ruby' && Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.3')
23
+ gem 'commonmarker', '~> 2.10', require: false
24
+ gem 'rubocop', '~> 1.92'
25
+ gem 'rubocop-md', '~> 3.0', require: false
26
+ gem 'rubocop-prose', '~> 0.2', require: false
27
+ gem 'rubocop-rake', '~> 0.7', require: false
28
+ gem 'rubocop-spellcheck', '~> 0.2', require: false
29
+ gem 'rubocop-yaml', '~> 0.1.0', require: false
30
+ gem 'ruby-gem-release', '0.9.0', require: false
31
+ end
30
32
  end
data/Gemfile.danger ADDED
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'danger', '~> 9.6', '>= 9.6.2', require: false
4
+ gem 'danger-changelog', '~> 0.10', require: false
5
+ gem 'danger-pr-comment', '~> 0.3', require: false