I am rebuilding Ferret indexes in setup() in tests and I've noticed that Ferret fails sometimes after that.
Ferret::FileNotFoundError (File Not Found Error occured at <except.c>:117 in xpo
p_context
Error occured in fs_store.c:329 - fs_open_input
tried to open "/home/sergei/NetBeansProjects/ims/config/../index/test/cl
assified/_8_0.del" but it doesn't exist: <No such file or directory>
I've traced it to ActsAsFerret::ClassMethods::rebuild_index method. The bug is caused incorrect index_dir assignment.
Here's patch:
Index: class_methods.rb
--- class_methods.rb Base (BASE)
+++ class_methods.rb Locally Modified (Based On LOCAL)
@@ -31,7 +31,7 @@
def rebuild_index(*models)
models << self unless models.include?(self)
aaf_index.rebuild_index models.map(&:to_s)
- index_dir = find_last_index_version(aaf_configuration[:index_base_dir]) unless aaf_configuration[:remote]
+ self.index_dir = find_last_index_version(aaf_configuration[:index_base_dir]) unless aaf_configuration[:remote]
end
# re-index a number records specified by the given ids. Use for large