athena 0.0.5.61 → 0.0.6.65
Sign up to get free protection for your applications and to get access to all the features.
- data/README +1 -1
- data/lib/athena/formats/ferret.rb +26 -15
- data/lib/athena/record.rb +8 -0
- data/lib/athena/version.rb +1 -1
- metadata +2 -2
data/README
CHANGED
@@ -57,26 +57,37 @@ class Athena::Formats
|
|
57
57
|
|
58
58
|
def parse(source)
|
59
59
|
path = source.path
|
60
|
-
|
60
|
+
|
61
|
+
# make sure the index can be opened
|
62
|
+
begin
|
63
|
+
File.open(File.join(path, 'segments')) {}
|
64
|
+
rescue Errno::ENOENT, Errno::EACCES => err
|
65
|
+
raise "can't open index at #{path} (#{err.to_s.sub(/ - .*/, '')})"
|
66
|
+
end
|
61
67
|
|
62
68
|
index = ::Ferret::Index::IndexReader.new(path)
|
69
|
+
first, last = 0, index.max_doc - 1
|
70
|
+
|
71
|
+
# make sure we can read from the index
|
72
|
+
begin
|
73
|
+
index[first]
|
74
|
+
index[last]
|
75
|
+
rescue StandardError # EOFError, "Not available", ...
|
76
|
+
raise "possible Ferret version mismatch; try to set the " <<
|
77
|
+
"FERRET_VERSION environment variable to something " <<
|
78
|
+
"other than #{Ferret::VERSION}"
|
79
|
+
end
|
63
80
|
|
64
|
-
|
65
|
-
|
81
|
+
first.upto(last) { |i|
|
82
|
+
unless index.deleted?(i)
|
83
|
+
doc = index[i]
|
66
84
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
85
|
+
Athena::Record.new(parser.block, doc[record_element]) { |record|
|
86
|
+
config.each { |element, field_config|
|
87
|
+
record.update(element, doc[element], field_config)
|
88
|
+
}
|
89
|
+
}
|
71
90
|
end
|
72
|
-
|
73
|
-
record = Athena::Record.new(parser.block, doc[record_element])
|
74
|
-
|
75
|
-
config.each { |element, field_config|
|
76
|
-
record.update(element, doc[element], field_config)
|
77
|
-
}
|
78
|
-
|
79
|
-
record.close
|
80
91
|
}
|
81
92
|
|
82
93
|
index.num_docs
|
data/lib/athena/record.rb
CHANGED
data/lib/athena/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: athena
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6.65
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jens Wille
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-12-
|
12
|
+
date: 2008-12-03 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|