mongoid-haystack 1.4.0 → 1.4.1
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.
- data/lib/mongoid-haystack.rb +1 -1
- data/lib/mongoid-haystack/token.rb +8 -1
- data/mongoid-haystack.gemspec +1 -1
- metadata +1 -1
data/lib/mongoid-haystack.rb
CHANGED
@@ -28,7 +28,7 @@ module Mongoid
|
|
28
28
|
|
29
29
|
# new we should have one token per uniq value
|
30
30
|
#
|
31
|
-
tokens = where(:value.in => values)
|
31
|
+
tokens = where(:value.in => values).to_a
|
32
32
|
|
33
33
|
# batch update the counts on the tokens by the number of times each
|
34
34
|
# value was seen in the list
|
@@ -41,6 +41,13 @@ module Mongoid
|
|
41
41
|
|
42
42
|
values.each do |value|
|
43
43
|
token = token_index[value]
|
44
|
+
|
45
|
+
unless token
|
46
|
+
token = Token.create!(:value => value)
|
47
|
+
value_index[value] ||= []
|
48
|
+
value_index[value].push(value)
|
49
|
+
end
|
50
|
+
|
44
51
|
count = value_index[value].size
|
45
52
|
counts[count] ||= []
|
46
53
|
counts[count].push(token.id)
|
data/mongoid-haystack.gemspec
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
Gem::Specification::new do |spec|
|
5
5
|
spec.name = "mongoid-haystack"
|
6
|
-
spec.version = "1.4.
|
6
|
+
spec.version = "1.4.1"
|
7
7
|
spec.platform = Gem::Platform::RUBY
|
8
8
|
spec.summary = "mongoid-haystack"
|
9
9
|
spec.description = "a mongoid 3 zero-config, zero-integration, POLS pure mongo fulltext solution"
|