mirror of
https://github.com/quickwit-oss/tantivy.git
synced 2026-01-06 09:12:55 +00:00
Standardizes the Index::create_* APIs (#317)
* Pull all creation methods next to each other The goal here is to make it clear which methods are performing the same function, and to assist with standardizing the API calls. * Make `from_directory` private This seems to be an internal function, so lets make it internal. * Rename `create` to `create_in_dir` This lets the name match the `create_in_ram` pattern and opens up `create` for the generic implementation. * Implement the generic create function All of the create methods now delegate to the common create function and future `create_in_*` functions now have a clear pattern to follow as well
This commit is contained in:
committed by
Paul Masurel
parent
0465876854
commit
2b8f02764b
@@ -61,7 +61,7 @@ fn run_example(index_path: &Path) -> tantivy::Result<()> {
|
||||
//
|
||||
// This will actually just save a meta.json
|
||||
// with our schema in the directory.
|
||||
let index = Index::create(index_path, schema.clone())?;
|
||||
let index = Index::create_in_dir(index_path, schema.clone())?;
|
||||
|
||||
// here we are registering our custome tokenizer
|
||||
// this will store tokens of 3 characters each
|
||||
|
||||
@@ -64,7 +64,7 @@ fn run_example(index_path: &Path) -> tantivy::Result<()> {
|
||||
//
|
||||
// This will actually just save a meta.json
|
||||
// with our schema in the directory.
|
||||
let index = Index::create(index_path, schema.clone())?;
|
||||
let index = Index::create_in_dir(index_path, schema.clone())?;
|
||||
|
||||
// To insert document we need an index writer.
|
||||
// There must be only one writer at a time.
|
||||
|
||||
Reference in New Issue
Block a user