Skip to content

Commit c12e7c0

Browse files
skeptrunedevcdxker
authored andcommitted
bugfix(server): enhance error logging and improve handling of chunk metadata in processing functions
1 parent d3e28ff commit c12e7c0

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

server/src/operators/chunk_operator.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,8 @@ pub async fn get_content_chunk_from_point_ids_query(
273273
.filter(chunk_metadata_columns::qdrant_point_id.eq_any(&point_ids))
274274
.load(&mut conn)
275275
.await
276-
.map_err(|_| {
276+
.map_err(|e| {
277+
log::error!("Failed to load content chunk metadatas: {:?}", e);
277278
ServiceError::BadRequest("Failed to load content chunk metadatas".to_string())
278279
})?;
279280

server/src/operators/model_operator.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -934,14 +934,15 @@ pub async fn cross_encoder(
934934
let common_request_docs = results
935935
.clone()
936936
.into_iter()
937-
.map(|x| {
938-
let chunk = match x.metadata.get(0).cloned() {
939-
Some(ChunkMetadataTypes::Metadata(metadata)) => Ok(metadata),
937+
.map(|score_chunk_dto| {
938+
let chunk_html = match score_chunk_dto.metadata.get(0).cloned() {
939+
Some(ChunkMetadataTypes::Metadata(chunk_metadata_string_tag_set)) => Ok(chunk_metadata_string_tag_set.chunk_html),
940+
Some(ChunkMetadataTypes::Content(content_chunk_metadata)) => Ok(content_chunk_metadata.chunk_html),
940941
_ => Err(ServiceError::BadRequest(
941-
"ChunkMetadataStringTagSet not found for chunk in results".to_string(),
942+
"Cannot rerank SlimChunkMetadata ScoreChunks since they do not have any text in their chunk_html".to_string(),
942943
)),
943944
}?;
944-
Ok(convert_html_to_text(&chunk.chunk_html.unwrap_or_default())
945+
Ok(convert_html_to_text(&chunk_html.unwrap_or_default())
945946
.split_whitespace()
946947
.take(max_words_to_rerank)
947948
.join(" "))

0 commit comments

Comments
 (0)