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.
@@ -2,7 +2,7 @@
2
2
  #
3
3
  module Mongoid
4
4
  module Haystack
5
- const_set(:Version, '1.4.0') unless const_defined?(:Version)
5
+ const_set(:Version, '1.4.1') unless const_defined?(:Version)
6
6
 
7
7
  class << Haystack
8
8
  def version
@@ -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)
@@ -3,7 +3,7 @@
3
3
 
4
4
  Gem::Specification::new do |spec|
5
5
  spec.name = "mongoid-haystack"
6
- spec.version = "1.4.0"
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"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid-haystack
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.4.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: