mongoid-sphinx 0.0.5 → 0.0.6

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.
@@ -64,23 +64,24 @@ module Mongoid
64
64
 
65
65
  self.all.each do |document_hash|
66
66
  sphinx_compatible_id = document_hash['_id'].to_s.to_i - 100000000000000000000000
67
-
68
- puts "<sphinx:document id=\"#{sphinx_compatible_id}\">"
69
-
70
- puts "<classname>#{self.to_s}</classname>"
71
- self.search_fields.each do |key|
72
- puts "<#{key}><![CDATA[[#{document_hash[key.to_s]}]]></#{key}>"
67
+ if sphinx_compatible_id > 0
68
+ puts "<sphinx:document id=\"#{sphinx_compatible_id}\">"
69
+
70
+ puts "<classname>#{self.to_s}</classname>"
71
+ self.search_fields.each do |key|
72
+ puts "<#{key}><![CDATA[[#{document_hash[key.to_s]}]]></#{key}>"
73
+ end
74
+ self.search_attributes.each do |key, value|
75
+ value = case value
76
+ when 'bool' : document_hash[key.to_s] ? 1 : 0
77
+ when 'timestamp' : document_hash[key.to_s].to_i
78
+ else document_hash[key.to_s].to_s
79
+ end
80
+ puts "<#{key}>#{value}</#{key}>"
81
+ end
82
+
83
+ puts '</sphinx:document>'
73
84
  end
74
- self.search_attributes.each do |key, value|
75
- value = case value
76
- when 'bool' : document_hash[key.to_s] ? 1 : 0
77
- when 'timestamp' : document_hash[key.to_s].to_i
78
- else document_hash[key.to_s].to_s
79
- end
80
- puts "<#{key}>#{value}</#{key}>"
81
- end
82
-
83
- puts '</sphinx:document>'
84
85
  end
85
86
 
86
87
  puts '</sphinx:docset>'
@@ -1,3 +1,3 @@
1
1
  module MongoidSphinx #:nodoc
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
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: 21
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 5
10
- version: 0.0.5
9
+ - 6
10
+ version: 0.0.6
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-01-12 00:00:00 -05:00
18
+ date: 2011-01-13 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency