Class: XapianDb::InMemoryDatabase

Inherits:
Database
  • Object
show all
Defined in:
lib/xapian_db/database.rb

Overview

In Memory database

Instance Attribute Summary

Attributes inherited from Database

#reader

Instance Method Summary collapse

Methods inherited from Database

#delete_doc_with_unique_term, #delete_docs_of_class, #facets, #find_similar_to, #search, #size, #store_doc

Methods included from Utilities

#assert_valid_keys, #camelize, #constantize

Constructor Details

#initializeInMemoryDatabase

Returns a new instance of InMemoryDatabase



179
180
181
182
# File 'lib/xapian_db/database.rb', line 179

def initialize
  @writer ||= Xapian::inmemory_open
  @reader = @writer
end

Instance Method Details

#commitObject

Commit all pending changes



191
192
193
# File 'lib/xapian_db/database.rb', line 191

def commit
  # Nothing to do for an in memory database
end

#resetObject

Reset (empty) the database



196
197
198
199
# File 'lib/xapian_db/database.rb', line 196

def reset
  @writer = Xapian::inmemory_open
  @reader = @writer
end

#writerXapian::WritableDatabase

Get the writer to write to the database

Returns:



186
187
188
# File 'lib/xapian_db/database.rb', line 186

def writer
  @writer
end