mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-30 17:14:59 +08:00
17 lines
522 B
Rust
17 lines
522 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()
|
||
|
}
|