Skip to content

Commit a501edd

Browse files
committed
Fix bug
1 parent e198444 commit a501edd

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

rust/worker/src/segment/types.rs

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -602,8 +602,12 @@ pub async fn materialize_logs<'me>(
602602
return Err(LogMaterializerError::MetadataMaterialization(e));
603603
}
604604
};
605-
record_from_map.final_document = log_record.record.document.clone();
606-
record_from_map.final_embedding = log_record.record.embedding.clone();
605+
if let Some(doc) = &log_record.record.document {
606+
record_from_map.final_document = Some(doc.clone());
607+
}
608+
if let Some(emb) = &log_record.record.embedding {
609+
record_from_map.final_embedding = Some(emb.clone());
610+
}
607611
match record_from_map.final_operation {
608612
MaterializedLogOperation::Initial => {
609613
record_from_map.final_operation =
@@ -661,8 +665,12 @@ pub async fn materialize_logs<'me>(
661665
return Err(LogMaterializerError::MetadataMaterialization(e));
662666
}
663667
};
664-
record_from_map.final_document = log_record.record.document.clone();
665-
record_from_map.final_embedding = log_record.record.embedding.clone();
668+
if let Some(doc) = &log_record.record.document {
669+
record_from_map.final_document = Some(doc.clone());
670+
}
671+
if let Some(emb) = &log_record.record.embedding {
672+
record_from_map.final_embedding = Some(emb.clone());
673+
}
666674
match record_from_map.final_operation {
667675
MaterializedLogOperation::Initial => {
668676
record_from_map.final_operation =
@@ -699,8 +707,12 @@ pub async fn materialize_logs<'me>(
699707
return Err(LogMaterializerError::MetadataMaterialization(e));
700708
}
701709
};
702-
record_from_map.final_document = log_record.record.document.clone();
703-
record_from_map.final_embedding = log_record.record.embedding.clone();
710+
if let Some(doc) = &log_record.record.document {
711+
record_from_map.final_document = Some(doc.clone());
712+
}
713+
if let Some(emb) = &log_record.record.embedding {
714+
record_from_map.final_embedding = Some(emb.clone());
715+
}
704716
// This record is not present on storage yet hence final operation is
705717
// AddNew and not UpdateExisting.
706718
record_from_map.final_operation = MaterializedLogOperation::AddNew;

0 commit comments

Comments
 (0)