mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-04 20:37:15 +02:00
fix: Update the DatabaseView to retrieve the index at creation
remove this computation from the QueryBuilder
This commit is contained in:
parent
7c98771068
commit
bec463a61a
2 changed files with 13 additions and 9 deletions
|
@ -5,7 +5,9 @@ use rocksdb::rocksdb::{DB, DBVector, Snapshot, SeekKey};
|
|||
use rocksdb::rocksdb_options::ReadOptions;
|
||||
use serde::de::DeserializeOwned;
|
||||
|
||||
use crate::database::{retrieve_data_schema, DocumentKey, DocumentKeyAttr};
|
||||
use crate::database::{DocumentKey, DocumentKeyAttr};
|
||||
use crate::database::{retrieve_data_schema, retrieve_data_index};
|
||||
use crate::database::blob::positive::PositiveBlob;
|
||||
use crate::database::deserializer::Deserializer;
|
||||
use crate::rank::criterion::Criterion;
|
||||
use crate::database::schema::Schema;
|
||||
|
@ -14,19 +16,25 @@ use crate::DocumentId;
|
|||
|
||||
pub struct DatabaseView<'a> {
|
||||
snapshot: Snapshot<&'a DB>,
|
||||
blob: PositiveBlob,
|
||||
schema: Schema,
|
||||
}
|
||||
|
||||
impl<'a> DatabaseView<'a> {
|
||||
pub fn new(snapshot: Snapshot<&'a DB>) -> Result<DatabaseView, Box<Error>> {
|
||||
let schema = retrieve_data_schema(&snapshot)?;
|
||||
Ok(DatabaseView { snapshot, schema })
|
||||
let blob = retrieve_data_index(&snapshot)?;
|
||||
Ok(DatabaseView { snapshot, blob, schema })
|
||||
}
|
||||
|
||||
pub fn schema(&self) -> &Schema {
|
||||
&self.schema
|
||||
}
|
||||
|
||||
pub fn blob(&self) -> &PositiveBlob {
|
||||
&self.blob
|
||||
}
|
||||
|
||||
pub fn into_snapshot(self) -> Snapshot<&'a DB> {
|
||||
self.snapshot
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue