mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-09 22:48:54 +01:00
Make the CI happy about the never type
This commit is contained in:
parent
8cb7001755
commit
af2b722fed
@ -897,91 +897,95 @@ impl IndexScheduler {
|
|||||||
dump_tasks.flush()?;
|
dump_tasks.flush()?;
|
||||||
|
|
||||||
// 3. Dump the indexes
|
// 3. Dump the indexes
|
||||||
self.index_mapper.try_for_each_index(&rtxn, |uid, index| -> Result<()> {
|
let () =
|
||||||
let rtxn = index.read_txn()?;
|
self.index_mapper.try_for_each_index(&rtxn, |uid, index| -> Result<()> {
|
||||||
let metadata = IndexMetadata {
|
let rtxn = index.read_txn()?;
|
||||||
uid: uid.to_owned(),
|
let metadata = IndexMetadata {
|
||||||
primary_key: index.primary_key(&rtxn)?.map(String::from),
|
uid: uid.to_owned(),
|
||||||
created_at: index.created_at(&rtxn)?,
|
primary_key: index.primary_key(&rtxn)?.map(String::from),
|
||||||
updated_at: index.updated_at(&rtxn)?,
|
created_at: index.created_at(&rtxn)?,
|
||||||
};
|
updated_at: index.updated_at(&rtxn)?,
|
||||||
let mut index_dumper = dump.create_index(uid, &metadata)?;
|
};
|
||||||
|
let mut index_dumper = dump.create_index(uid, &metadata)?;
|
||||||
|
|
||||||
let fields_ids_map = index.fields_ids_map(&rtxn)?;
|
let fields_ids_map = index.fields_ids_map(&rtxn)?;
|
||||||
let all_fields: Vec<_> = fields_ids_map.iter().map(|(id, _)| id).collect();
|
let all_fields: Vec<_> = fields_ids_map.iter().map(|(id, _)| id).collect();
|
||||||
let embedding_configs = index.embedding_configs(&rtxn)?;
|
let embedding_configs = index.embedding_configs(&rtxn)?;
|
||||||
|
|
||||||
// 3.1. Dump the documents
|
// 3.1. Dump the documents
|
||||||
for ret in index.all_documents(&rtxn)? {
|
for ret in index.all_documents(&rtxn)? {
|
||||||
if self.must_stop_processing.get() {
|
if self.must_stop_processing.get() {
|
||||||
return Err(Error::AbortedTask);
|
return Err(Error::AbortedTask);
|
||||||
}
|
|
||||||
|
|
||||||
let (id, doc) = ret?;
|
|
||||||
|
|
||||||
let mut document = milli::obkv_to_json(&all_fields, &fields_ids_map, doc)?;
|
|
||||||
|
|
||||||
'inject_vectors: {
|
|
||||||
let embeddings = index.embeddings(&rtxn, id)?;
|
|
||||||
|
|
||||||
if embeddings.is_empty() {
|
|
||||||
break 'inject_vectors;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let vectors = document
|
let (id, doc) = ret?;
|
||||||
.entry(RESERVED_VECTORS_FIELD_NAME.to_owned())
|
|
||||||
.or_insert(serde_json::Value::Object(Default::default()));
|
|
||||||
|
|
||||||
let serde_json::Value::Object(vectors) = vectors else {
|
let mut document =
|
||||||
return Err(milli::Error::UserError(
|
milli::obkv_to_json(&all_fields, &fields_ids_map, doc)?;
|
||||||
milli::UserError::InvalidVectorsMapType {
|
|
||||||
document_id: {
|
'inject_vectors: {
|
||||||
if let Ok(Some(Ok(index))) = index
|
let embeddings = index.embeddings(&rtxn, id)?;
|
||||||
.external_id_of(&rtxn, std::iter::once(id))
|
|
||||||
.map(|it| it.into_iter().next())
|
if embeddings.is_empty() {
|
||||||
{
|
break 'inject_vectors;
|
||||||
index
|
}
|
||||||
} else {
|
|
||||||
format!("internal docid={id}")
|
let vectors = document
|
||||||
}
|
.entry(RESERVED_VECTORS_FIELD_NAME.to_owned())
|
||||||
|
.or_insert(serde_json::Value::Object(Default::default()));
|
||||||
|
|
||||||
|
let serde_json::Value::Object(vectors) = vectors else {
|
||||||
|
return Err(milli::Error::UserError(
|
||||||
|
milli::UserError::InvalidVectorsMapType {
|
||||||
|
document_id: {
|
||||||
|
if let Ok(Some(Ok(index))) = index
|
||||||
|
.external_id_of(&rtxn, std::iter::once(id))
|
||||||
|
.map(|it| it.into_iter().next())
|
||||||
|
{
|
||||||
|
index
|
||||||
|
} else {
|
||||||
|
format!("internal docid={id}")
|
||||||
|
}
|
||||||
|
},
|
||||||
|
value: vectors.clone(),
|
||||||
},
|
},
|
||||||
value: vectors.clone(),
|
)
|
||||||
},
|
.into());
|
||||||
)
|
|
||||||
.into());
|
|
||||||
};
|
|
||||||
|
|
||||||
for (embedder_name, embeddings) in embeddings {
|
|
||||||
let user_provided = embedding_configs
|
|
||||||
.iter()
|
|
||||||
.find(|conf| conf.name == embedder_name)
|
|
||||||
.is_some_and(|conf| conf.user_provided.contains(id));
|
|
||||||
|
|
||||||
let embeddings = ExplicitVectors {
|
|
||||||
embeddings: Some(
|
|
||||||
VectorOrArrayOfVectors::from_array_of_vectors(embeddings),
|
|
||||||
),
|
|
||||||
regenerate: !user_provided,
|
|
||||||
};
|
};
|
||||||
vectors.insert(
|
|
||||||
embedder_name,
|
for (embedder_name, embeddings) in embeddings {
|
||||||
serde_json::to_value(embeddings).unwrap(),
|
let user_provided = embedding_configs
|
||||||
);
|
.iter()
|
||||||
|
.find(|conf| conf.name == embedder_name)
|
||||||
|
.is_some_and(|conf| conf.user_provided.contains(id));
|
||||||
|
|
||||||
|
let embeddings = ExplicitVectors {
|
||||||
|
embeddings: Some(
|
||||||
|
VectorOrArrayOfVectors::from_array_of_vectors(
|
||||||
|
embeddings,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
regenerate: !user_provided,
|
||||||
|
};
|
||||||
|
vectors.insert(
|
||||||
|
embedder_name,
|
||||||
|
serde_json::to_value(embeddings).unwrap(),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
index_dumper.push_document(&document)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
index_dumper.push_document(&document)?;
|
// 3.2. Dump the settings
|
||||||
}
|
let settings = meilisearch_types::settings::settings(
|
||||||
|
index,
|
||||||
// 3.2. Dump the settings
|
&rtxn,
|
||||||
let settings = meilisearch_types::settings::settings(
|
meilisearch_types::settings::SecretPolicy::RevealSecrets,
|
||||||
index,
|
)?;
|
||||||
&rtxn,
|
index_dumper.settings(&settings)?;
|
||||||
meilisearch_types::settings::SecretPolicy::RevealSecrets,
|
Ok(())
|
||||||
)?;
|
})?;
|
||||||
index_dumper.settings(&settings)?;
|
|
||||||
Ok(())
|
|
||||||
})?;
|
|
||||||
|
|
||||||
// 4. Dump experimental feature settings
|
// 4. Dump experimental feature settings
|
||||||
let features = self.features().runtime_features();
|
let features = self.features().runtime_features();
|
||||||
|
Loading…
Reference in New Issue
Block a user