mongoid_search 0.3.6 → 0.4.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 (5) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +16 -0
  3. data/lib/mongoid_search/util.rb +1 -1
  4. metadata +11 -13
  5. data/VERSION +0 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 65d13fcd90c890df7b15f2175b701e951259f8de
4
- data.tar.gz: '097843e60c25fc38ddb96789093dc798a08c5739'
2
+ SHA256:
3
+ metadata.gz: 4f3da97e4dd6f65400548a1e6f12e957fe0c2d5c8a390e015cd8d20572474c73
4
+ data.tar.gz: 71423ee292ac1f9e53cb4ef4171d4309c25ca56895203bd53c6bc2d8641fb385
5
5
  SHA512:
6
- metadata.gz: a13b1d7f1bce08ffed931346ec1b1b6750ad984aeb263d93fc1c1db3dd8d03761a763958fb8d000ec19b0ea98b791e3d15020cd152375dbc5d5e19338cc5944f
7
- data.tar.gz: 71008ecd40e79df705f769d03e0b03953a3278b3cb46ceb325b212e48b8c1321c58aa540750b094d8a94cc9082cbd66e13bba145ebfc7c0af6f78ce7a72fa796
6
+ metadata.gz: 59b2511bea3017819e52c2633e8ac8cc19158e7da43042584b9fccc4f815b2a2e57fa4b1407e2ee5726d36710473f0cc9143b7b750586c802658869a0c6f7c23
7
+ data.tar.gz: 65bfb18a5361a333d815b92bafc34bbe5133c04b28c9e4540397605f98eb76123338119b2b5ee911b5074e85d68d84cc6547ab059845bd4698eb0b5beaaf2f02
data/README.md CHANGED
@@ -73,6 +73,22 @@ Product.full_text_search("apple iphone").size
73
73
  # => 1
74
74
  ```
75
75
 
76
+ You can also search in "virtual" fields by defining them as methods. This can be useful when you have a method with dynamic fields (i.e. variable schema).
77
+ ```ruby
78
+ class ModelWithDynamicFields
79
+
80
+ ...
81
+
82
+ search_in :search_data
83
+
84
+ def search_data
85
+ # concatenate all String fields' values
86
+ self.attributes.select{|k,v| v.is_a?(String) }.values.join(' ')
87
+ end
88
+ end
89
+ ```
90
+ Mongoid_search will run the method before save and use it's output to populate the `_keywords` field.
91
+
76
92
  Of course, some models could have more than one index. For instance, two different searches with different fields, so you could even specify from which index should be searched:
77
93
 
78
94
  ```ruby
@@ -40,7 +40,7 @@ module Mongoid::Search::Util
40
40
  return [] if text.blank?
41
41
  text = text.to_s
42
42
  .mb_chars
43
- .normalize(:kd)
43
+ .unicode_normalize(:nfkd)
44
44
  .downcase
45
45
  .to_s
46
46
  .gsub(strip_symbols, ' ') # strip symbols
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid_search
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.6
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mauricio Zaffari
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-17 00:00:00.000000000 Z
11
+ date: 2020-07-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fast-stemmer
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 3.0.0
33
+ version: 5.0.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 3.0.0
40
+ version: 5.0.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: database_cleaner
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -70,14 +70,14 @@ dependencies:
70
70
  name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "<"
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '11.0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "<"
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '11.0'
83
83
  - !ruby/object:Gem::Dependency
@@ -104,7 +104,6 @@ files:
104
104
  - LICENSE
105
105
  - README.md
106
106
  - Rakefile
107
- - VERSION
108
107
  - lib/mongoid_search.rb
109
108
  - lib/mongoid_search/log.rb
110
109
  - lib/mongoid_search/mongoid_search.rb
@@ -120,7 +119,7 @@ files:
120
119
  - spec/mongoid_search_spec.rb
121
120
  - spec/spec_helper.rb
122
121
  - spec/util_spec.rb
123
- homepage: http://www.papodenerd.net/mongoid-search-full-text-search-for-your-mongoid-models/
122
+ homepage: https://github.com/mongoid/mongoid_search
124
123
  licenses:
125
124
  - MIT
126
125
  metadata: {}
@@ -139,18 +138,17 @@ required_rubygems_version: !ruby/object:Gem::Requirement
139
138
  - !ruby/object:Gem::Version
140
139
  version: 1.3.6
141
140
  requirements: []
142
- rubyforge_project:
143
- rubygems_version: 2.6.14
141
+ rubygems_version: 3.0.3
144
142
  signing_key:
145
143
  specification_version: 4
146
144
  summary: Search implementation for Mongoid ORM
147
145
  test_files:
146
+ - spec/spec_helper.rb
147
+ - spec/config/ignorelist.yml
148
148
  - spec/models/variant.rb
149
149
  - spec/models/category.rb
150
- - spec/models/product.rb
151
150
  - spec/models/tag.rb
151
+ - spec/models/product.rb
152
152
  - spec/models/subproduct.rb
153
- - spec/config/ignorelist.yml
154
- - spec/spec_helper.rb
155
153
  - spec/util_spec.rb
156
154
  - spec/mongoid_search_spec.rb
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.3.6