mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-12-23 21:20:24 +01:00
Small changes following review
This commit is contained in:
parent
3f212a8202
commit
e35ef31738
@ -422,8 +422,11 @@ fn extract_vector_document_diff(
|
|||||||
VectorStateDelta::NowRemoved
|
VectorStateDelta::NowRemoved
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// when the vectors are no longer user-provided,
|
// inline to the left is not supposed to be possible because the embedder is not new, so `_vectors` was removed from
|
||||||
// we generate the prompt unconditionally
|
// the previous version of the document.
|
||||||
|
// Manual -> Generated is also not possible without an Inline to the right (which is handled above)
|
||||||
|
// Generated -> Generated is handled above, so not possible
|
||||||
|
// As a result, this code is unreachable
|
||||||
(_not_generated, VectorState::Generated) => {
|
(_not_generated, VectorState::Generated) => {
|
||||||
// Do we keep this document?
|
// Do we keep this document?
|
||||||
let document_is_kept = obkv
|
let document_is_kept = obkv
|
||||||
@ -443,7 +446,10 @@ fn extract_vector_document_diff(
|
|||||||
VectorStateDelta::NowRemoved
|
VectorStateDelta::NowRemoved
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(_old, VectorState::Manual) => {
|
// inline to the left is not possible because the embedder is not new, and so `_vectors` was removed from the previous
|
||||||
|
// version of the document.
|
||||||
|
// however the Rust type system cannot know that.
|
||||||
|
(_manual, VectorState::Manual) => {
|
||||||
// Do we keep this document?
|
// Do we keep this document?
|
||||||
let document_is_kept = obkv
|
let document_is_kept = obkv
|
||||||
.iter()
|
.iter()
|
||||||
|
@ -866,6 +866,7 @@ impl<'a, 'i> Transform<'a, 'i> {
|
|||||||
|
|
||||||
// The operations that we must perform on the different fields.
|
// The operations that we must perform on the different fields.
|
||||||
let mut operations = HashMap::new();
|
let mut operations = HashMap::new();
|
||||||
|
let mut error_seen = false;
|
||||||
|
|
||||||
let mut obkv_writer = KvWriter::<_, FieldId>::memory();
|
let mut obkv_writer = KvWriter::<_, FieldId>::memory();
|
||||||
'write_fid: for (id, val) in old_obkv.iter() {
|
'write_fid: for (id, val) in old_obkv.iter() {
|
||||||
@ -886,7 +887,10 @@ impl<'a, 'i> Transform<'a, 'i> {
|
|||||||
match existing_vectors {
|
match existing_vectors {
|
||||||
Ok(existing_vectors) => existing_vectors,
|
Ok(existing_vectors) => existing_vectors,
|
||||||
Err(error) => {
|
Err(error) => {
|
||||||
|
if !error_seen {
|
||||||
tracing::error!(%error, "Unexpected `_vectors` field that is not a map. Treating as an empty map");
|
tracing::error!(%error, "Unexpected `_vectors` field that is not a map. Treating as an empty map");
|
||||||
|
error_seen = true;
|
||||||
|
}
|
||||||
Default::default()
|
Default::default()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1182,7 +1182,6 @@ pub struct InnerIndexSettingsDiff {
|
|||||||
pub(crate) old: InnerIndexSettings,
|
pub(crate) old: InnerIndexSettings,
|
||||||
pub(crate) new: InnerIndexSettings,
|
pub(crate) new: InnerIndexSettings,
|
||||||
pub(crate) primary_key_id: Option<FieldId>,
|
pub(crate) primary_key_id: Option<FieldId>,
|
||||||
// TODO: compare directly the embedders.
|
|
||||||
pub(crate) embedding_config_updates: BTreeMap<String, EmbedderAction>,
|
pub(crate) embedding_config_updates: BTreeMap<String, EmbedderAction>,
|
||||||
pub(crate) settings_update_only: bool,
|
pub(crate) settings_update_only: bool,
|
||||||
/// The set of only the additional searchable fields.
|
/// The set of only the additional searchable fields.
|
||||||
|
@ -101,13 +101,6 @@ pub struct WriteBackToDocuments {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl SettingsDiff {
|
impl SettingsDiff {
|
||||||
pub fn should_reindex(&self) -> bool {
|
|
||||||
match self {
|
|
||||||
SettingsDiff::Remove { .. } | SettingsDiff::Reindex { .. } => true,
|
|
||||||
SettingsDiff::UpdateWithoutReindex { .. } => false,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn from_settings(old: EmbeddingSettings, new: Setting<EmbeddingSettings>) -> Self {
|
pub fn from_settings(old: EmbeddingSettings, new: Setting<EmbeddingSettings>) -> Self {
|
||||||
match new {
|
match new {
|
||||||
Setting::Set(new) => {
|
Setting::Set(new) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user