mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-09-05 20:26:31 +00:00
Make clippy happy
This commit is contained in:
committed by
Louis Dureuil
parent
24b017e367
commit
619900e4d3
@ -5,7 +5,6 @@ use std::sync::atomic::{AtomicU32, AtomicUsize, Ordering};
|
|||||||
use std::sync::{Arc, RwLock};
|
use std::sync::{Arc, RwLock};
|
||||||
use std::time::{Duration, Instant};
|
use std::time::{Duration, Instant};
|
||||||
|
|
||||||
use enum_iterator::Sequence;
|
|
||||||
use indexmap::IndexMap;
|
use indexmap::IndexMap;
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
@ -485,7 +485,7 @@ where
|
|||||||
|
|
||||||
// If an embedder wasn't used in the typedchunk but must be binary quantized
|
// If an embedder wasn't used in the typedchunk but must be binary quantized
|
||||||
// we should insert it in `dimension`
|
// we should insert it in `dimension`
|
||||||
let index_version = self.index.get_version(&self.wtxn)?.unwrap();
|
let index_version = self.index.get_version(self.wtxn)?.unwrap();
|
||||||
for (name, action) in settings_diff.embedding_config_updates.iter() {
|
for (name, action) in settings_diff.embedding_config_updates.iter() {
|
||||||
if action.is_being_quantized && !dimension.contains_key(name.as_str()) {
|
if action.is_being_quantized && !dimension.contains_key(name.as_str()) {
|
||||||
let index = self.index.embedding_configs().embedder_id(self.wtxn, name)?.ok_or(
|
let index = self.index.embedding_configs().embedder_id(self.wtxn, name)?.ok_or(
|
||||||
|
@ -129,8 +129,7 @@ impl VectorStore {
|
|||||||
self._arroy_items_in_store(rtxn, self.arroy_angular_db(), store_id, with_items)
|
self._arroy_items_in_store(rtxn, self.arroy_angular_db(), store_id, with_items)
|
||||||
.map_err(Into::into)
|
.map_err(Into::into)
|
||||||
}
|
}
|
||||||
} else {
|
} else if self.quantized {
|
||||||
if self.quantized {
|
|
||||||
self._items_in_store(rtxn, self.quantized_db(), store_id, with_items)
|
self._items_in_store(rtxn, self.quantized_db(), store_id, with_items)
|
||||||
.map_err(Into::into)
|
.map_err(Into::into)
|
||||||
} else {
|
} else {
|
||||||
@ -138,7 +137,6 @@ impl VectorStore {
|
|||||||
.map_err(Into::into)
|
.map_err(Into::into)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
fn _arroy_items_in_store<D: arroy::Distance, F, O>(
|
fn _arroy_items_in_store<D: arroy::Distance, F, O>(
|
||||||
&self,
|
&self,
|
||||||
@ -193,8 +191,7 @@ impl VectorStore {
|
|||||||
.transpose()?
|
.transpose()?
|
||||||
.map(|reader| reader.dimensions()))
|
.map(|reader| reader.dimensions()))
|
||||||
}
|
}
|
||||||
} else {
|
} else if self.quantized {
|
||||||
if self.quantized {
|
|
||||||
Ok(self
|
Ok(self
|
||||||
.readers(rtxn, self.quantized_db())
|
.readers(rtxn, self.quantized_db())
|
||||||
.next()
|
.next()
|
||||||
@ -208,7 +205,6 @@ impl VectorStore {
|
|||||||
.map(|reader| reader.dimensions()))
|
.map(|reader| reader.dimensions()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
pub fn convert_from_arroy(&self, wtxn: &mut RwTxn, progress: Progress) -> crate::Result<()> {
|
pub fn convert_from_arroy(&self, wtxn: &mut RwTxn, progress: Progress) -> crate::Result<()> {
|
||||||
if self.quantized {
|
if self.quantized {
|
||||||
@ -550,8 +546,7 @@ impl VectorStore {
|
|||||||
}
|
}
|
||||||
writer.contains_item(rtxn, item)?
|
writer.contains_item(rtxn, item)?
|
||||||
}
|
}
|
||||||
} else {
|
} else if self.quantized {
|
||||||
if self.quantized {
|
|
||||||
let writer = hannoy::Writer::new(self.quantized_db(), index, dimension);
|
let writer = hannoy::Writer::new(self.quantized_db(), index, dimension);
|
||||||
if writer.is_empty(rtxn)? {
|
if writer.is_empty(rtxn)? {
|
||||||
continue;
|
continue;
|
||||||
@ -563,7 +558,6 @@ impl VectorStore {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
writer.contains_item(rtxn, item)?
|
writer.contains_item(rtxn, item)?
|
||||||
}
|
|
||||||
};
|
};
|
||||||
if contains {
|
if contains {
|
||||||
return Ok(contains);
|
return Ok(contains);
|
||||||
@ -587,15 +581,13 @@ impl VectorStore {
|
|||||||
self._arroy_nns_by_item(rtxn, self.arroy_angular_db(), item, limit, filter)
|
self._arroy_nns_by_item(rtxn, self.arroy_angular_db(), item, limit, filter)
|
||||||
.map_err(Into::into)
|
.map_err(Into::into)
|
||||||
}
|
}
|
||||||
} else {
|
} else if self.quantized {
|
||||||
if self.quantized {
|
|
||||||
self._nns_by_item(rtxn, self.quantized_db(), item, limit, filter)
|
self._nns_by_item(rtxn, self.quantized_db(), item, limit, filter)
|
||||||
.map_err(Into::into)
|
.map_err(Into::into)
|
||||||
} else {
|
} else {
|
||||||
self._nns_by_item(rtxn, self.angular_db(), item, limit, filter).map_err(Into::into)
|
self._nns_by_item(rtxn, self.angular_db(), item, limit, filter).map_err(Into::into)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
fn _arroy_nns_by_item<D: arroy::Distance>(
|
fn _arroy_nns_by_item<D: arroy::Distance>(
|
||||||
&self,
|
&self,
|
||||||
@ -669,8 +661,7 @@ impl VectorStore {
|
|||||||
self._arroy_nns_by_vector(rtxn, self.arroy_angular_db(), vector, limit, filter)
|
self._arroy_nns_by_vector(rtxn, self.arroy_angular_db(), vector, limit, filter)
|
||||||
.map_err(Into::into)
|
.map_err(Into::into)
|
||||||
}
|
}
|
||||||
} else {
|
} else if self.quantized {
|
||||||
if self.quantized {
|
|
||||||
self._nns_by_vector(rtxn, self.quantized_db(), vector, limit, filter)
|
self._nns_by_vector(rtxn, self.quantized_db(), vector, limit, filter)
|
||||||
.map_err(Into::into)
|
.map_err(Into::into)
|
||||||
} else {
|
} else {
|
||||||
@ -678,7 +669,6 @@ impl VectorStore {
|
|||||||
.map_err(Into::into)
|
.map_err(Into::into)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
fn _arroy_nns_by_vector<D: arroy::Distance>(
|
fn _arroy_nns_by_vector<D: arroy::Distance>(
|
||||||
&self,
|
&self,
|
||||||
@ -754,8 +744,7 @@ impl VectorStore {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else if self.quantized {
|
||||||
if self.quantized {
|
|
||||||
for reader in self.readers(rtxn, self.quantized_db()) {
|
for reader in self.readers(rtxn, self.quantized_db()) {
|
||||||
if let Some(vec) = reader?.item_vector(rtxn, item_id)? {
|
if let Some(vec) = reader?.item_vector(rtxn, item_id)? {
|
||||||
vectors.push(vec);
|
vectors.push(vec);
|
||||||
@ -768,7 +757,6 @@ impl VectorStore {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Ok(vectors)
|
Ok(vectors)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user