Struct tantivy::Index[][src]

pub struct Index { /* fields omitted */ }
Expand description

Search Index

Implementations

Creates a new builder.

Examines the directory to see if it contains an index.

Effectively, it only checks for the presence of the meta.json file.

Accessor to the search executor.

This pool is used by default when calling searcher.search(...) to perform search on the individual segments.

By default the executor is single thread, and simply runs in the calling thread.

Replace the default single thread search executor pool by a thread pool with a given number of threads.

Replace the default single thread search executor pool by a thread pool with a given number of threads.

Creates a new index using the RamDirectory.

The index will be allocated in anonymous memory. This is useful for indexing small set of documents for instances like unit test or temporary in memory index.

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.

Opens or creates a new index in the provided directory

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.

Creates a new index given an implementation of the trait Directory.

If a directory previously existed, it will be erased.

Accessor for the tokenizer manager.

Helper to access the tokenizer associated to a specific field.

Create a default IndexReader for the given index.

See Index.reader_builder().

Create a IndexReader for the given index.

Most project should create at most one reader for a given index. This method is typically called only once per Index instance, over the lifetime of most problem.

Opens a new directory from an index path.

Creates a new segment_meta (Advanced user only).

As long as the SegmentMeta lives, the files associated with the SegmentMeta are guaranteed to not be garbage collected, regardless of whether the segment is recorded as part of the index or not.

Open the index using the provided directory

Reads the index meta file from the directory.

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 defines the number of indexing workers that should work at the same time.

  • overall_heap_size_in_bytes sets the amount of memory allocated for all indexing thread. Each thread will receive a budget of overall_heap_size_in_bytes / num_threads.

Errors

If the lockfile already exists, returns Error::DirectoryLockBusy or an Error::IoError.

Panics

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

Creates a multithreaded writer

Tantivy will automatically define the number of threads to use, but no more than [MAX_NUM_THREAD] threads. overall_heap_size_in_bytes is the total target memory usage that will be split between a given number of 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 settings

Accessor to the index settings

Accessor to the index schema

The schema is actually cloned.

Returns the list of segments that are searchable

Creates a new segment.

Return a reference to the index directory.

Return a mutable reference to the index directory.

Reads the meta.json and returns the list of SegmentMeta from the last commit.

Returns the list of segment ids that are searchable.

Returns the set of corrupted files

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait. Read more

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait. Read more

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s. Read more

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s. Read more

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait. Read more

Performs the conversion.

Performs the conversion.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.