simserver.SessionServer

class simserver.SessionServer(basedir, autosession=True, use_locks=True)[source]

Similarity server on top of SimServer that implements sessions = transactions.

A transaction is a set of server modifications (index/delete/train calls) that may be either committed or rolled back entirely.

Sessions are realized by:

  1. cloning (=copying) a SimServer at the beginning of a session
  2. serving read-only queries from the original server (the clone may be modified during queries)
  3. modifications affect only the clone
  4. at commit, the clone becomes the original
  5. at rollback, do nothing (clone is discarded, next transaction starts from the original again)

Methods

__init__(basedir[, autosession, use_locks])
buffer(*args, **kwargs) Buffer documents, in the current session
check_session(*args, **kwargs) Make sure a session is open.
close(*args, **kwargs) Don’t wait for gc, try to release important resources manually
commit(*args, **kwargs) Commit changes made by the latest session.
debug_model()
delete(*args, **kwargs) Delete documents from the current session.
drop_index(*args, **kwargs) Drop all indexed documents from the session.
find_similar(*args, **kwargs) Find similar articles.
index(*args, **kwargs) Index documents, in the current session
keys()
load(fname[, mmap]) Load a previously saved object from file (also see save).
location(name)
open_session(*args, **kwargs) Open a new session to modify this server.
optimize(*args, **kwargs) Optimize index for faster by-document-id queries.
rollback(*args, **kwargs) Ignore all changes made in the latest session (terminate the session).
save(fname_or_handle[, separately, ...]) Save the object to file (also see load).
set_autosession(*args, **kwargs) Turn autosession (automatic committing after each modification call) on/off.
status()
terminate(*args, **kwargs) Delete all files created by this server, invalidating self.
train(*args, **kwargs) Update semantic model, in the current session.
write_istable(*args, **kwargs)