lib/xapian_db/config.rb in xapian_db-1.2.2 vs lib/xapian_db/config.rb in xapian_db-1.2.2.1

- old
+ new

@@ -91,12 +91,19 @@ # Set the index writer # @param [Symbol] type The writer type; the following adapters are available: # - :direct ({XapianDb::IndexWriters::DirectWriter}) # - :beanstalk ({XapianDb::IndexWriters::BeanstalkWriter}) + # - :resque ({XapianDb::IndexWriters::ResqueWriter}) def writer(type) # We try to guess the writer name - @_writer = XapianDb::IndexWriters.const_get("#{camelize(type.to_s)}Writer") + begin + require File.dirname(__FILE__) + "/index_writers/#{type}_writer" + @_writer = XapianDb::IndexWriters.const_get("#{camelize(type.to_s)}Writer") + rescue LoadError + puts "XapianDb: cannot load #{type} writer; see README for supported writers and how to install neccessary queue infrastructure" + raise + end end # Set the url and port of the beanstalk daemon # @param [Symbol] url The url of the beanstalk daemon; defaults to localhost:11300 def beanstalk_daemon_url(url)