mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-23 02:27:40 +08:00
apply review comment
This commit is contained in:
parent
74199f328d
commit
f6483cf15d
@ -1648,25 +1648,15 @@ impl Index {
|
|||||||
let mut res = BTreeMap::new();
|
let mut res = BTreeMap::new();
|
||||||
let embedding_configs = self.embedding_configs(rtxn)?;
|
let embedding_configs = self.embedding_configs(rtxn)?;
|
||||||
for config in embedding_configs {
|
for config in embedding_configs {
|
||||||
// TODO: return internal error instead
|
|
||||||
let embedder_id = self.embedder_category_id.get(rtxn, &config.name)?.unwrap();
|
let embedder_id = self.embedder_category_id.get(rtxn, &config.name)?.unwrap();
|
||||||
let embedder_id = (embedder_id as u16) << 8;
|
let embeddings = self
|
||||||
|
.arroy_readers(rtxn, embedder_id, config.config.quantized())
|
||||||
let mut embeddings = Vec::new();
|
.map_while(|reader| {
|
||||||
'vectors: for i in 0..=u8::MAX {
|
reader
|
||||||
let reader = ArroyWrapper::new(
|
.and_then(|r| r.item_vector(rtxn, docid).map_err(|e| e.into()))
|
||||||
self.vector_arroy,
|
.transpose()
|
||||||
embedder_id | (i as u16),
|
})
|
||||||
config.config.quantized(),
|
.collect::<Result<Vec<_>>>()?;
|
||||||
);
|
|
||||||
match reader.item_vector(rtxn, docid) {
|
|
||||||
Err(arroy::Error::MissingMetadata(_)) => break 'vectors,
|
|
||||||
Err(err) => return Err(err.into()),
|
|
||||||
Ok(None) => break 'vectors,
|
|
||||||
Ok(Some(embedding)) => embeddings.push(embedding),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
res.insert(config.name.to_owned(), embeddings);
|
res.insert(config.name.to_owned(), embeddings);
|
||||||
}
|
}
|
||||||
Ok(res)
|
Ok(res)
|
||||||
|
Loading…
Reference in New Issue
Block a user