mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-30 09:04:59 +08: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()
|
|
}
|