mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-26 23:04:26 +01:00
feat: Add a raw constructor for Metadata
This commit is contained in:
parent
b91c4f89d5
commit
9fd62f1592
@ -118,13 +118,17 @@ impl Metadata {
|
|||||||
{
|
{
|
||||||
let map = Map::from_path(map)?;
|
let map = Map::from_path(map)?;
|
||||||
let indexes = DocIndexes::from_path(indexes)?;
|
let indexes = DocIndexes::from_path(indexes)?;
|
||||||
Ok(Metadata { map, indexes })
|
Ok(Metadata::from_raw(map, indexes))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn from_bytes(map: Vec<u8>, indexes: Vec<u8>) -> Result<Self, Box<Error>> {
|
pub fn from_bytes(map: Vec<u8>, indexes: Vec<u8>) -> Result<Self, Box<Error>> {
|
||||||
let map = Map::from_bytes(map)?;
|
let map = Map::from_bytes(map)?;
|
||||||
let indexes = DocIndexes::from_bytes(indexes)?;
|
let indexes = DocIndexes::from_bytes(indexes)?;
|
||||||
Ok(Metadata { map, indexes })
|
Ok(Metadata::from_raw(map, indexes))
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn from_raw(map: Map, indexes: DocIndexes) -> Self {
|
||||||
|
Metadata { map, indexes }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get<K: AsRef<[u8]>>(&self, key: K) -> Option<&[DocIndex]> {
|
pub fn get<K: AsRef<[u8]>>(&self, key: K) -> Option<&[DocIndex]> {
|
||||||
|
Loading…
Reference in New Issue
Block a user