Smaller review changes

This commit is contained in:
Louis Dureuil 2024-05-22 12:26:00 +02:00
parent 3412e7fbcf
commit 8a941c0241
No known key found for this signature in database
4 changed files with 14 additions and 13 deletions

View File

@ -31,7 +31,9 @@ use meilisearch_types::milli::heed::CompactionOption;
use meilisearch_types::milli::update::{ use meilisearch_types::milli::update::{
IndexDocumentsConfig, IndexDocumentsMethod, IndexerConfig, Settings as MilliSettings, IndexDocumentsConfig, IndexDocumentsMethod, IndexerConfig, Settings as MilliSettings,
}; };
use meilisearch_types::milli::vector::parsed_vectors::RESERVED_VECTORS_FIELD_NAME; use meilisearch_types::milli::vector::parsed_vectors::{
ExplicitVectors, VectorOrArrayOfVectors, RESERVED_VECTORS_FIELD_NAME,
};
use meilisearch_types::milli::{self, Filter}; use meilisearch_types::milli::{self, Filter};
use meilisearch_types::settings::{apply_settings_to_builder, Settings, Unchecked}; use meilisearch_types::settings::{apply_settings_to_builder, Settings, Unchecked};
use meilisearch_types::tasks::{Details, IndexSwap, Kind, KindWithContent, Status, Task}; use meilisearch_types::tasks::{Details, IndexSwap, Kind, KindWithContent, Status, Task};
@ -955,12 +957,13 @@ impl IndexScheduler {
for (embedder_name, embeddings) in embeddings { for (embedder_name, embeddings) in embeddings {
// don't change the entry if it already exists, because it was user-provided // don't change the entry if it already exists, because it was user-provided
vectors.entry(embedder_name).or_insert_with(|| { vectors.entry(embedder_name).or_insert_with(|| {
let embeddings = ExplicitVectors {
let embeddings = milli::vector::parsed_vectors::ExplicitVectors { embeddings: VectorOrArrayOfVectors::from_array_of_vectors(
embeddings: milli::vector::parsed_vectors::VectorOrArrayOfVectors::from_array_of_vectors(embeddings), embeddings,
user_provided: false, ),
}; user_provided: false,
serde_json::to_value(embeddings).unwrap() };
serde_json::to_value(embeddings).unwrap()
}); });
} }
} }

View File

@ -23,7 +23,7 @@ use crate::heed_codec::{
}; };
use crate::order_by_map::OrderByMap; use crate::order_by_map::OrderByMap;
use crate::proximity::ProximityPrecision; use crate::proximity::ProximityPrecision;
use crate::vector::EmbeddingConfig; use crate::vector::{Embedding, EmbeddingConfig};
use crate::{ use crate::{
default_criteria, CboRoaringBitmapCodec, Criterion, DocumentId, ExternalDocumentsIds, default_criteria, CboRoaringBitmapCodec, Criterion, DocumentId, ExternalDocumentsIds,
FacetDistribution, FieldDistribution, FieldId, FieldIdMapMissingEntry, FieldIdWordCountCodec, FacetDistribution, FieldDistribution, FieldId, FieldIdMapMissingEntry, FieldIdWordCountCodec,
@ -1611,7 +1611,7 @@ impl Index {
&self, &self,
rtxn: &RoTxn<'_>, rtxn: &RoTxn<'_>,
docid: DocumentId, docid: DocumentId,
) -> Result<BTreeMap<String, Vec<crate::vector::Embedding>>> { ) -> Result<BTreeMap<String, Vec<Embedding>>> {
let mut res = BTreeMap::new(); let mut res = BTreeMap::new();
for row in self.embedder_category_id.iter(rtxn)? { for row in self.embedder_category_id.iter(rtxn)? {
let (embedder_name, embedder_id) = row?; let (embedder_name, embedder_id) = row?;

View File

@ -89,7 +89,7 @@ struct EmbedderVectorExtractor {
pub fn extract_vector_points<R: io::Read + io::Seek>( pub fn extract_vector_points<R: io::Read + io::Seek>(
obkv_documents: grenad::Reader<R>, obkv_documents: grenad::Reader<R>,
indexer: GrenadParameters, indexer: GrenadParameters,
settings_diff: Arc<InnerIndexSettingsDiff>, settings_diff: &InnerIndexSettingsDiff,
) -> Result<Vec<ExtractedVectorPoints>> { ) -> Result<Vec<ExtractedVectorPoints>> {
puffin::profile_function!(); puffin::profile_function!();
@ -258,8 +258,6 @@ pub fn extract_vector_points<R: io::Read + io::Seek>(
} }
} }
/////
let mut results = Vec::new(); let mut results = Vec::new();
for EmbedderVectorExtractor { for EmbedderVectorExtractor {

View File

@ -241,7 +241,7 @@ fn send_original_documents_data(
let original_documents_chunk = original_documents_chunk.clone(); let original_documents_chunk = original_documents_chunk.clone();
let lmdb_writer_sx = lmdb_writer_sx.clone(); let lmdb_writer_sx = lmdb_writer_sx.clone();
rayon::spawn(move || { rayon::spawn(move || {
match extract_vector_points(original_documents_chunk.clone(), indexer, settings_diff) { match extract_vector_points(original_documents_chunk.clone(), indexer, &settings_diff) {
Ok(extracted_vectors) => { Ok(extracted_vectors) => {
for ExtractedVectorPoints { for ExtractedVectorPoints {
manual_vectors, manual_vectors,