mongoid-sphinx 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/mongoid_sphinx/mongoid/sphinx.rb +17 -16
- data/lib/mongoid_sphinx/version.rb +1 -1
- metadata +4 -4
@@ -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
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
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>'
|
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:
|
4
|
+
hash: 19
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
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-
|
18
|
+
date: 2011-01-13 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|