Struct tantivy::Index [] [src]

pub struct Index { /* fields omitted */ }

Tantivy's Search Index

Methods

impl Index
[src]

Creates a new index using the RAMDirectory.

The index will be allocated in anonymous memory. This should only be used for unit tests.

Creates a new index in a given filepath. The index will use the MMapDirectory.

If a previous index was in this directory, then its meta file will be destroyed.

Creates a new index in a temp directory.

The index will use the MMapDirectory in a newly created directory. The temp directory will be destroyed automatically when the Index object is destroyed.

The temp directory is only used for testing the MmapDirectory. For other unit tests, prefer the RAMDirectory, see: create_in_ram.

Opens a new directory from a directory.

Opens a new directory from an index path.

Returns the index docstamp.

The docstamp is the number of documents that have been added from the beginning of time, and until the moment of the last commit.

Creates a multithreaded writer. Each writer produces an independent segment.

Errors

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

Panics

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

Creates a multithreaded writer It just calls writer_with_num_threads with the number of cores as num_threads

Errors

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

Panics

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

Accessor to the index schema

The schema is actually cloned.

Returns the list of segments that are searchable

Remove all of the file associated with the segment.

This method cannot fail. If a problem occurs, some files may end up never being removed. The error will only be logged.

Return a segment object given a segment_id

The segment may or may not exist.

Return a reference to the index directory.

Return a mutable reference to the index directory.

Creates a new segment.

Creates a new generation of searchers after a change of the set of searchable indexes.

This needs to be called when a new segment has been published or after a merge.

Returns a searcher

This method should be called every single time a search query is performed. The searchers are taken from a pool of NUM_SEARCHERS searchers. If no searcher is available this may block.

The same searcher must be used for a given query, as it ensures the use of a consistent segment set.

Trait Implementations

impl Debug for Index
[src]

Formats the value using the given formatter.

impl Clone for Index
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more