mongoid-fulltextable 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/mongoid/fulltextable-version.rb +1 -1
- data/lib/mongoid/fulltextable.rb +8 -4
- metadata +3 -3
data/lib/mongoid/fulltextable.rb
CHANGED
@@ -4,7 +4,7 @@ require 'active_support/concern'
|
|
4
4
|
require 'core_ext/string'
|
5
5
|
|
6
6
|
module Mongoid
|
7
|
-
|
7
|
+
|
8
8
|
module Fulltextable
|
9
9
|
|
10
10
|
extend ActiveSupport::Concern
|
@@ -54,7 +54,7 @@ module Mongoid
|
|
54
54
|
def update_keywords_from_fields
|
55
55
|
keywords = index_fields.map do |field|
|
56
56
|
value = self.send(field).to_s
|
57
|
-
simplified = value.without_accents
|
57
|
+
simplified = value.without_accents if value.respond_to?(:without_accents)
|
58
58
|
|
59
59
|
simplified == value ? value : [value, simplified]
|
60
60
|
end.reject(&:blank?).compact.flatten.uniq
|
@@ -71,11 +71,15 @@ module Mongoid
|
|
71
71
|
end
|
72
72
|
|
73
73
|
def indexes(*args)
|
74
|
-
|
74
|
+
keywords = args.reject(&:blank?).compact.uniq.map do |value|
|
75
|
+
simplified = value.without_accents if value.respond_to?(:without_accents)
|
76
|
+
simplified == value ? value : [value, simplified]
|
77
|
+
end.flatten
|
78
|
+
self._keywords += keywords
|
75
79
|
end
|
76
80
|
|
77
81
|
end
|
78
82
|
|
79
83
|
end
|
80
|
-
|
84
|
+
|
81
85
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 2
|
9
|
+
version: 0.1.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- "Ji\xC5\x99\xC3\xAD Zajpt"
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-11-23 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|