mongoid-sphinx 0.1.2 → 0.1.3

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.
@@ -1,19 +1,23 @@
1
1
  module Mongoid
2
2
  class Identity
3
3
 
4
- protected
4
+ private
5
5
 
6
6
  # Return an id that is sphinx compatible
7
7
  def generate_id
8
- while true
9
- id = 100000000000000000000000 + rand(4294967294) # 4,294,967,295 is the theoretical max number of documents a 32 bit sphinx install can index
10
- candidate = id.to_s
8
+ if @document.class.embedded?
9
+ id = BSON::ObjectId.new
10
+ else
11
+ while true
12
+ id = 100000000000000000000000 + rand(4294967294) # 4,294,967,295 is the theoretical max number of documents a 32 bit sphinx install can index
13
+ candidate = id.to_s
11
14
 
12
- begin
13
- @document.class.find(candidate) # Resource not found exception if available
14
- rescue Mongoid::Errors::DocumentNotFound
15
- id = BSON::ObjectId.from_string(candidate)
16
- break
15
+ begin
16
+ @document.class.find(candidate) # Resource not found exception if available
17
+ rescue Mongoid::Errors::DocumentNotFound
18
+ id = BSON::ObjectId.from_string(candidate)
19
+ break
20
+ end
17
21
  end
18
22
  end
19
23
  @document.using_object_ids? ? id : id.to_s
@@ -1,3 +1,3 @@
1
1
  module MongoidSphinx #:nodoc
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid-sphinx
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 2
10
- version: 0.1.2
9
+ - 3
10
+ version: 0.1.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Matt Hodgson
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-03-01 00:00:00 -05:00
18
+ date: 2011-03-14 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency