mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-23 13:24:27 +01:00
16 lines
521 B
Rust
16 lines
521 B
Rust
|
use meilidb_data::{Database};
|
||
|
use meilidb_data::Index;
|
||
|
use meilidb_schema::{SchemaBuilder, DISPLAYED, INDEXED};
|
||
|
|
||
|
pub fn simple_index() -> Index {
|
||
|
let tmp_dir = tempfile::tempdir().unwrap();
|
||
|
let database = Database::open(&tmp_dir).unwrap();
|
||
|
|
||
|
let mut builder = SchemaBuilder::with_identifier("objectId");
|
||
|
builder.new_attribute("objectId", DISPLAYED | INDEXED);
|
||
|
builder.new_attribute("title", DISPLAYED | INDEXED);
|
||
|
let schema = builder.build();
|
||
|
|
||
|
database.create_index("hello", schema).unwrap()
|
||
|
}
|