aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/plugins
diff options
context:
space:
mode:
authorRobin Houston <robin.houston@gmail.com>2012-02-01 22:04:58 +0000
committerRobin Houston <robin.houston@gmail.com>2012-02-01 22:04:58 +0000
commitea04caec95cea132143997a1870ae8dd1fc0db5c (patch)
treef199e3f4187091a7a7c78f7fd6901529658174f7 /vendor/plugins
parent59b5b15d56600ffc26d657dfea134ffcfc879725 (diff)
parenta76010c99459559a29901ed75b847384248c7c6e (diff)
Merge branch 'release/0.5' into develop
Diffstat (limited to 'vendor/plugins')
-rw-r--r--vendor/plugins/acts_as_xapian/lib/acts_as_xapian.rb15
1 files changed, 9 insertions, 6 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 ebb3b1cbd..d5c0e89c6 100644
--- a/vendor/plugins/acts_as_xapian/lib/acts_as_xapian.rb
+++ b/vendor/plugins/acts_as_xapian/lib/acts_as_xapian.rb
@@ -116,14 +116,17 @@ module ActsAsXapian
raise NoXapianRubyBindingsError.new("Xapian Ruby bindings not installed") unless ActsAsXapian.bindings_available
raise "acts_as_xapian hasn't been called in any models" if @@init_values.empty?
- # if DB is not nil, then we're already initialised, so don't do it again
- # XXX we need to reopen the database each time, so Xapian gets changes to it.
- # Hopefully in later version of Xapian it will autodetect this, and this can
- # be commented back in again.
- # return unless @@db.nil?
-
prepare_environment
+ # We need to reopen the database each time, so Xapian gets changes to it.
+ # Calling reopen() does not always pick up changes for reasons that I can
+ # only speculate about at the moment. (It is easy to reproduce this by
+ # changing the code below to use reopen() rather than open() followed by
+ # close(), and running rake spec.)
+ if !@@db.nil?
+ @@db.close
+ end
+
# basic Xapian objects
begin
@@db = Xapian::Database.new(@@db_path)