aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Houston <robin.houston@gmail.com>2012-01-06 13:18:09 +0000
committerRobin Houston <robin.houston@gmail.com>2012-01-06 13:18:09 +0000
commit38e30c682504e8cd5ace61f2fc937d100eae3c65 (patch)
treee28657b446e304c16e49e705bdaabf3439bfa0c9
parenta434d89ef0479fb3776833621a79db253de6b674 (diff)
parentb97c388419ff4cd42efb6ad665c255b954858822 (diff)
Merge branch 'release/0.5' into wdtk
-rw-r--r--vendor/plugins/acts_as_xapian/lib/acts_as_xapian.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/vendor/plugins/acts_as_xapian/lib/acts_as_xapian.rb b/vendor/plugins/acts_as_xapian/lib/acts_as_xapian.rb
index fb6a08979..48f796c32 100644
--- a/vendor/plugins/acts_as_xapian/lib/acts_as_xapian.rb
+++ b/vendor/plugins/acts_as_xapian/lib/acts_as_xapian.rb
@@ -218,7 +218,7 @@ module ActsAsXapian
full_path = @@db_path + suffix
# for indexing
- @@writable_db = Xapian::flint_open(full_path, Xapian::DB_CREATE_OR_OPEN)
+ @@writable_db = Xapian::WritableDatabase.new(full_path, Xapian::DB_CREATE_OR_OPEN)
@@term_generator = Xapian::TermGenerator.new()
@@term_generator.set_flags(Xapian::TermGenerator::FLAG_SPELLING, 0)
@@term_generator.database = @@writable_db
@@ -583,6 +583,10 @@ module ActsAsXapian
ActsAsXapian.writable_db.close
end
+ def ActsAsXapian._is_xapian_db(path)
+ return File.exist?(File.join(temp_path, "iamflint")) or File.exist?(File.join(temp_path, "iamchert"))
+ end
+
# You must specify *all* the models here, this totally rebuilds the Xapian
# database. You'll want any readers to reopen the database after this.
#
@@ -597,7 +601,7 @@ module ActsAsXapian
# Delete any existing .new database, and open a new one
new_path = ActsAsXapian.db_path + ".new"
if File.exist?(new_path)
- raise "found existing " + new_path + " which is not Xapian flint database, please delete for me" if not File.exist?(File.join(new_path, "iamflint"))
+ raise "found existing " + new_path + " which is not Xapian flint database, please delete for me" if not ActsAsXapian._is_xapian_db(new_path)
FileUtils.rm_r(new_path)
end
@@ -623,7 +627,7 @@ module ActsAsXapian
old_path = ActsAsXapian.db_path
temp_path = ActsAsXapian.db_path + ".tmp"
if File.exist?(temp_path)
- raise "temporary database found " + temp_path + " which is not Xapian flint database, please delete for me" if not File.exist?(File.join(temp_path, "iamflint"))
+ raise "temporary database found " + temp_path + " which is not Xapian flint database, please delete for me" if not ActsAsXapian._is_xapian_db(temp_path)
FileUtils.rm_r(temp_path)
end
if File.exist?(old_path)
@@ -633,7 +637,7 @@ module ActsAsXapian
# Delete old database
if File.exist?(temp_path)
- raise "old database now at " + temp_path + " is not Xapian flint database, please delete for me" if not File.exist?(File.join(temp_path, "iamflint"))
+ raise "old database now at " + temp_path + " is not Xapian flint database, please delete for me" if not ActsAsXapian._is_xapian_db(temp_path)
FileUtils.rm_r(temp_path)
end