mongoid_fulltext 0.8.0 → 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 (57) hide show
  1. checksums.yaml +5 -5
  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 +131 -51
  10. data/.spellcheck.txt +181 -0
  11. data/CHANGELOG.md +57 -31
  12. data/Dangerfile +5 -1
  13. data/Gemfile +22 -18
  14. data/Gemfile.danger +5 -0
  15. data/README.md +171 -179
  16. data/RELEASING.md +60 -0
  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/indexable.rb +1 -1
  22. data/lib/mongoid/full_text_search/indexes.rb +1 -1
  23. data/lib/mongoid/full_text_search/ngrams.rb +93 -0
  24. data/lib/mongoid/full_text_search/version.rb +1 -1
  25. data/lib/mongoid/full_text_search.rb +112 -144
  26. data/mongoid_fulltext.gemspec +4 -4
  27. data/script/release.rb +13 -0
  28. data/spec/models/chinese_artwork.rb +7 -0
  29. data/spec/models/filtered_artist.rb +1 -2
  30. data/spec/models/filtered_artwork.rb +1 -2
  31. data/spec/models/filtered_other.rb +1 -2
  32. data/spec/models/localized_artwork.rb +29 -0
  33. data/spec/models/multilingual_artwork.rb +7 -0
  34. data/spec/models/partitioned_artist.rb +1 -1
  35. data/spec/models/russian_artwork.rb +1 -2
  36. data/spec/models/scoped_artwork.rb +14 -0
  37. data/spec/models/tagged_artwork.rb +9 -0
  38. data/spec/models/weighted_artwork.rb +34 -0
  39. data/spec/mongoid/array_fields_spec.rb +43 -0
  40. data/spec/mongoid/bulk_indexing_spec.rb +56 -0
  41. data/spec/mongoid/candidate_limits_spec.rb +19 -0
  42. data/spec/mongoid/criteria_search_spec.rb +73 -0
  43. data/spec/mongoid/full_text_search_spec.rb +41 -12
  44. data/spec/mongoid/localized_fields_spec.rb +197 -0
  45. data/spec/mongoid/ngram_sampling_spec.rb +55 -0
  46. data/spec/mongoid/non_latin_spec.rb +50 -0
  47. data/spec/mongoid/timeout_option_spec.rb +18 -0
  48. data/spec/mongoid/weighted_fields_spec.rb +102 -0
  49. data/spec/release/release_spec.rb +60 -0
  50. data/spec/spec_helper.rb +22 -7
  51. data/spec/support/mongoid.rb +6 -4
  52. data/spec/unit/field_scores_spec.rb +54 -0
  53. data/spec/unit/index_definition_spec.rb +48 -0
  54. data/spec/unit/ngrams_spec.rb +73 -0
  55. data/spec/version_spec.rb +7 -0
  56. metadata +62 -11
  57. data/.travis.yml +0 -30
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,130 +1,156 @@
1
- ### 0.8.0 (1/19/2017)
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)
24
+
25
+ * [#35](https://github.com/mongoid/mongoid_fulltext/pull/35): Mongoid 7 compatibility - [@tomasc](https://github.com/tomasc).
26
+
27
+ ### 0.8.0 (2017/01/19)
2
28
 
3
29
  * [#28](https://github.com/mongoid/mongoid_fulltext/pull/28): Moved to the mongoid organization - [@dblock](https://github.com/dblock).
4
30
  * [#28](https://github.com/mongoid/mongoid_fulltext/pull/29): Compatibility with Mongoid 6 - [@dblock](https://github.com/dblock).
5
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).
6
32
  * [#31](https://github.com/mongoid/mongoid_fulltext/pull/31): Added danger, PR linter - [@dblock](https://github.com/dblock).
7
33
 
8
- ### 0.7.1 (11/18/2015)
34
+ ### 0.7.1 (2015/11/18)
9
35
 
10
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).
11
37
 
12
- ### 0.7.0 (9/18/2015)
38
+ ### 0.7.0 (2015/09/18)
13
39
 
14
40
  * Compatible with Mongoid 4 and 5 - [@dblock](https://github.com/dblock).
15
41
  * Rewritten .gemspec, removed Jeweler - [@dblock](https://github.com/dblock).
16
42
  * Added RuboCop - [@dblock](https://github.com/dblock).
17
43
 
18
- ### 0.6.1 (4/3/2013)
44
+ ### 0.6.1 (2013/04/03)
19
45
 
20
46
  * [#6](https://github.com/mongoid/mongoid_fulltext/pull/6): Upgrade to Mongoid ~> 3.0 - [@simi](https://github.com/simi).
21
47
 
22
- ### 0.6.0 (7/16/2012)
48
+ ### 0.6.0 (2012/07/16)
23
49
 
24
50
  * [#2](https://github.com/mongoid/mongoid_fulltext/pull/2): Upgrade to Mongoid 3.0 - [@volmer](https://github.com/volmer).
25
51
  * [#1](https://github.com/mongoid/mongoid_fulltext/pull/1): Fix: downcase destroys non-latin strings - [@netoneko](https://github.com/netoneko).
26
52
 
27
- ### 0.5.8 (3/8/2012)
53
+ ### 0.5.8 (2012/03/08)
28
54
 
29
55
  * Fix: do not CGI.unescape inside fulltext search - [@dblock](https://github.com/dblock).
30
56
  * Refactored array filter API, allowing for overriding filter query method - [@ethul](https://github.com/ethul).
31
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).
32
58
  * Added install instructions to Readme - [@Nerian](https://github.com/Nerian).
33
59
 
34
- ### 0.5.7 (1/11/2012)
60
+ ### 0.5.7 (2012/01/11)
35
61
 
36
62
  * Added `reindex_immediately` option to suppress automatic reindexing - [@joeyAghion](https://github.com/joeyAghion).
37
63
  * Fix: treatment of word separators, adding newlines, tabs and dashes into the set of default word separators - [@aaw](https://github.com/aaw).
38
64
 
39
- ### 0.5.4 (11/8/2011)
65
+ ### 0.5.4 (2011/11/08)
40
66
 
41
67
  * Made full word and prefix bumps inversely proportional to the length of the string - [@aaw](https://github.com/aaw).
42
68
 
43
- ### 0.5.3 (11/8/2011)
69
+ ### 0.5.3 (2011/11/08)
44
70
 
45
71
  * Added an option to index short prefixes of words - [@aaw](https://github.com/aaw).
46
72
 
47
- ### 0.5.2 (11/5/2011)
73
+ ### 0.5.2 (2011/11/05)
48
74
 
49
75
  * Added the ability to index full words that are less than the ngram length and not stop words - [@aaw](https://github.com/aaw).
50
76
 
51
- ### 0.5.1 (11/2/2011)
77
+ ### 0.5.1 (2011/11/02)
52
78
 
53
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).
54
80
  * Added UTF8 downcasing - [@zepplock](https://github.com/zepplock).
55
81
 
56
- ### 0.5.0 (10/11/2011)
82
+ ### 0.5.0 (2011/10/11)
57
83
 
58
84
  * Fix: inconsistet scoring words with the same length as the ngram length - [@aaw](https://github.com/aaw).
59
85
 
60
- ### 0.4.5 (10/5/2011)
86
+ ### 0.4.5 (2011/10/05)
61
87
 
62
88
  * Added `update_if` config option to control when index updates occur - [@nickhoffman](https://github.com/nickhoffman).
63
89
 
64
- ### 0.4.4 (8/31/2011)
90
+ ### 0.4.4 (2011/08/31)
65
91
 
66
92
  * Added `remove_accents` - [@tdp2110](https://github.com/tdp2110).
67
93
 
68
- ### 0.4.3 (8/3/2011)
94
+ ### 0.4.3 (2011/08/03)
69
95
 
70
96
  * Fix: including `Mongoid::FulltextSearch` and not using it causes created_indexes to fail - [@dblock](https://github.com/dblock).
71
97
 
72
- ### 0.4.2 (6/28/2011)
98
+ ### 0.4.2 (2011/06/28)
73
99
 
74
100
  * Delay-creating indexes in sync with how Mongoid creates indexes on normal collections - [@dblock](https://github.com/dblock).
75
101
 
76
- ### 0.4.1 (6/27/2011)
102
+ ### 0.4.1 (2011/06/27)
77
103
 
78
104
  * Using `Mongoid.logger` for logging - [@dblock](https://github.com/dblock).
79
- * 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).
80
106
 
81
- ### 0.4.0 (6/19/2011)
107
+ ### 0.4.0 (2011/06/19)
82
108
 
83
109
  * Removing all use of map-reduce - [@aaw](https://github.com/aaw).
84
110
  * Support class name with module for example (Module::ClassConstantName) - [@steverandy](https://github.com/steverandy).
85
111
 
86
- ### 0.3.7 (6/7/2011)
112
+ ### 0.3.7 (2011/06/07)
87
113
 
88
- * 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).
89
115
 
90
- ### 0.3.6 (5/27/2011)
116
+ ### 0.3.6 (2011/05/27)
91
117
 
92
118
  * Skipping words that are shorter than the n-gram - [@dblock](https://github.com/dblock).
93
119
  * Added `index_full_words` - [@dblock](https://github.com/dblock).
94
- * 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).
95
121
 
96
- ### 0.3.5 (5/25/2011)
122
+ ### 0.3.5 (2011/05/25)
97
123
 
98
124
  * Added index on document_id for faster remove - [@dblock](https://github.com/dblock).
99
125
  * Addeda way to return scored results - [@dblock](https://github.com/dblock).
100
126
 
101
- ### 0.3.4 (5/16/2011)
127
+ ### 0.3.4 (2011/05/16)
102
128
 
103
129
  * Added support for array filters - [@dblock](https://github.com/dblock).
104
130
  * Added support for Ruby 1.8.7 - [@dbussink](https://github.com/dbussink).
105
131
 
106
- ### 0.3.2 (4/19/2011)
132
+ ### 0.3.2 (2011/04/19)
107
133
 
108
134
  * Exposing `update_ngram_index` and `remove_from_ngram_index` for fast bulk-updating the index - [@aaw](https://github.com/aaw).
109
135
 
110
- ### 0.3.1 (4/14/2011)
136
+ ### 0.3.1 (2011/04/14)
111
137
 
112
138
  * Support for mongo versions >= 1.7.4 - [@aaw](https://github.com/aaw).
113
139
 
114
- ### 0.3.0 (4/13/2011)
140
+ ### 0.3.0 (2011/04/13)
115
141
 
116
142
  * Adding the ability to define filters on an index - [@aaw](https://github.com/aaw).
117
143
 
118
- ### 0.2.0 (4/13/2011)
144
+ ### 0.2.0 (2011/04/13)
119
145
 
120
146
  * Multiple indexes per model, removing internal indexes entirely - [@aaw](https://github.com/aaw).
121
147
 
122
- ### 0.1.1 (4/11/2011)
148
+ ### 0.1.1 (2011/04/11)
123
149
 
124
150
  * Keep garbage in the index from blowing up `fulltext_search` - [@aaw](https://github.com/aaw).
125
151
  * Indexing the results of `to_s` if no fields are provided - [@aaw](https://github.com/aaw).
126
152
  * Adding a `before_destroy` callback for external indexes - [@aaw](https://github.com/aaw).
127
153
 
128
- ### 0.1.0 (4/7/2011)
154
+ ### 0.1.0 (2011/04/07)
129
155
 
130
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,28 +1,32 @@
1
- source 'http://rubygems.org'
1
+ source 'https://rubygems.org'
2
2
 
3
- case version = ENV['MONGOID_VERSION'] || '6'
4
- when /6/
5
- gem 'mongoid', '~> 6.0'
6
- when /5/
7
- gem 'mongoid', '~> 5.0'
8
- when /4/
9
- gem 'mongoid', '~> 4.0'
10
- when /3.1.0/
11
- gem 'mongoid', '~> 3.1.0'
12
- when /3.0.0/
13
- gem 'mongoid', '~> 3.0.0'
14
- else
15
- gem 'mongoid', version
16
- 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
17
7
 
18
8
  gemspec
19
9
 
20
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
21
16
  gem 'rspec'
17
+ gem 'simplecov', RUBY_VERSION < '2.5' ? '~> 0.16.0' : '~> 0.22', require: false if ENV['COVERAGE'] == 'true'
22
18
  end
23
19
 
24
20
  group :development do
25
- gem 'rake', '< 11'
26
- gem 'rubocop', '0.34.1'
27
- gem 'mongoid-danger', '~> 0.1.1'
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
28
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