Skip to content

Commit

Permalink
wip in memory indexing
Browse files Browse the repository at this point in the history
  • Loading branch information
christian-toscano committed Aug 29, 2023
1 parent 63eba72 commit 9c47fc0
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/index.rs
Expand Up @@ -55,7 +55,6 @@ methods!(
facet_fields: Vec<String>
);

let index_path = MmapDirectory::open(path).try_unwrap();
let mut schema_builder = Schema::builder();

schema_builder.add_text_field("id", STRING | STORED);
Expand Down Expand Up @@ -97,7 +96,7 @@ methods!(
}

let schema = schema_builder.build();
let index = Index::open_or_create(index_path, schema.clone()).try_unwrap();
let index = Index::create_in_ram(schema.clone());
let tokenizers = index.tokenizers();

tokenizers.register("default", unwrap_tokenizer(&default_tokenizer).clone());
Expand All @@ -113,7 +112,7 @@ methods!(
.reload_policy(ReloadPolicy::Manual)
.try_into()
.try_unwrap();

klass().wrap_data(
TantinyIndex { index, index_writer, index_reader, schema },
&*TANTINY_INDEX_WRAPPER
Expand Down Expand Up @@ -285,4 +284,4 @@ pub(super) fn init() {
klass.def("__reload", reload);
klass.def("__search", search);
});
}
}

0 comments on commit 9c47fc0

Please sign in to comment.