mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-26 03:55:07 +08:00
implement open index
This commit is contained in:
parent
ddd7789713
commit
d22fab5bae
13
Cargo.lock
generated
13
Cargo.lock
generated
@ -1710,6 +1710,7 @@ dependencies = [
|
||||
"bstr",
|
||||
"byte-unit",
|
||||
"byteorder",
|
||||
"chrono",
|
||||
"crossbeam-channel",
|
||||
"csv",
|
||||
"either",
|
||||
@ -1724,13 +1725,13 @@ dependencies = [
|
||||
"levenshtein_automata",
|
||||
"linked-hash-map",
|
||||
"log",
|
||||
"meilisearch-tokenizer",
|
||||
"memmap",
|
||||
"near-proximity",
|
||||
"num-traits",
|
||||
"obkv",
|
||||
"once_cell",
|
||||
"ordered-float",
|
||||
"page_size",
|
||||
"pest 2.1.3 (git+https://github.com/pest-parser/pest.git?rev=51fd1d49f1041f7839975664ef71fe15c7dcaf67)",
|
||||
"pest_derive",
|
||||
"rayon",
|
||||
@ -1739,6 +1740,7 @@ dependencies = [
|
||||
"roaring",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_millis",
|
||||
"slice-group-by",
|
||||
"smallstr",
|
||||
"smallvec",
|
||||
@ -2605,6 +2607,15 @@ dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_millis"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e6e2dc780ca5ee2c369d1d01d100270203c4ff923d2a4264812d723766434d00"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_qs"
|
||||
version = "0.8.2"
|
||||
|
@ -67,8 +67,9 @@ struct IndexMetadata {
|
||||
}
|
||||
|
||||
impl IndexMetadata {
|
||||
fn open_index(&self) -> Result<Self> {
|
||||
todo!()
|
||||
fn open_index(&self, path: impl AsRef<Path>) -> Result<Self> {
|
||||
let path = path.as_ref().to_path_buf().push("indexes").push(&self.id);
|
||||
Ok(Index::new(self.options, path)?)
|
||||
}
|
||||
}
|
||||
|
||||
@ -79,7 +80,7 @@ struct IndexView<'a, U> {
|
||||
}
|
||||
|
||||
struct IndexViewMut<'a, U> {
|
||||
txn: heed::RwTxn<'a>,
|
||||
txn: heed::RwTxn<'a, 'a>,
|
||||
index: &'a Index,
|
||||
update_store: &'a U,
|
||||
}
|
||||
@ -97,7 +98,7 @@ impl<'a, U> Deref for IndexViewMut<'a, U> {
|
||||
}
|
||||
|
||||
impl<'a, U: UpdateStore> IndexView<'a, U> {
|
||||
fn search(&self, search_query: SearchQuery) -> Result<SearchResult> {
|
||||
pub fn search(&self, search_query: SearchQuery) -> Result<SearchResult> {
|
||||
let mut search = self.index.search(self.txn);
|
||||
if let Some(query) = &search_query.q {
|
||||
search.query(query);
|
||||
|
Loading…
Reference in New Issue
Block a user