def database(path)

      # If the current database is a persistent database, we must release the
      # database and run the garbage collector to remove the write lock
      if @_database.is_a?(XapianDb::PersistentDatabase)
        @_database = nil
        GC.start
      end

      if path.to_sym == :memory
        @_database = XapianDb.create_db
      else
        begin
          @_database = XapianDb.open_db :path => path
        rescue IOError
          @_database = XapianDb.create_db :path => path
        end
      end
    end
def database(path)

      # If the current database is a persistent database, we must release the
      # database and run the garbage collector to remove the write lock
      if @_database.is_a?(XapianDb::PersistentDatabase)
        @_database = nil
        GC.start
      end

      if path.to_sym == :memory
        @_database = XapianDb.create_db
      else
        begin
          @_database = XapianDb.open_db :path => path
        rescue IOError
          @_database = XapianDb.create_db :path => path
        end
      end
    end
Set the global database to use
 @param [String] path The path to the database. Either apply a file sytem path or :memory
   for an in memory database