Struct tantivy::IndexWriter [] [src]

pub struct IndexWriter { /* fields omitted */ }

IndexWriter is the user entry-point to add document to an index.

It manages a small number of indexing thread, as well as a shared indexing queue. Each indexing thread builds its own independant Segment, via a SegmentWriter object.

Methods

impl IndexWriter
[src]

The index writer

Open a new index writer. Attempts to acquire a lockfile.

The lockfile should be deleted on drop, but it is possible that due to a panic or other error, a stale lockfile will be left in the index directory. If you are sure that no other IndexWriter on the system is accessing the index directory, it is safe to manually delete the lockfile.

num_threads specifies the number of indexing workers that should work at the same time.

Errors

If the lockfile already exists, returns Error::FileAlreadyExists.

Panics

If the heap size per thread is too small, panics.

Returns a clone of the index_writer merge policy.

Set the merge policy.

Merges a given list of segments

Rollback to the last commit

This cancels all of the update that happened before after the last commit. After calling rollback, the index is in the same state as it was after the last commit.

The docstamp at the last commit is returned.

Commits all of the pending changes

A call to commit blocks. After it returns, all of the document that were added since the last commit are published and persisted.

In case of a crash or an hardware failure (as long as the hard disk is spared), it will be possible to resume indexing from this point.

Commit returns the docstamp of the last document that made it in the commit.

Adds a document.

If the indexing pipeline is full, this call may block.

The docstamp is an increasing u64 that can be used by the client to align commits with its own document queue.

Currently it represents the number of documents that have been added since the creation of the index.

Trait Implementations

impl !Send for IndexWriter
[src]

impl !Sync for IndexWriter
[src]