Skip to content

Commit 09085db

Browse files
committed
feature: add timings to all search routes in chunk_handler
1 parent dabdacf commit 09085db

File tree

4 files changed

+80
-129
lines changed

4 files changed

+80
-129
lines changed

server/src/bin/ingestion-microservice.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use trieve_server::operators::chunk_operator::{
1515
update_chunk_metadata_query,
1616
};
1717
use trieve_server::operators::event_operator::create_event_query;
18-
use trieve_server::operators::model_operator::{create_embeddings, get_splade_embedding};
18+
use trieve_server::operators::model_operator::{create_embeddings, get_sparse_vector};
1919
use trieve_server::operators::parse_operator::{
2020
average_embeddings, coarse_doc_chunker, convert_html_to_text,
2121
};
@@ -420,7 +420,7 @@ async fn upload_chunk(
420420
};
421421

422422
let splade_vector = if dataset_config.FULLTEXT_ENABLED {
423-
match get_splade_embedding(&content.clone(), "doc").await {
423+
match get_sparse_vector(&content.clone(), "doc").await {
424424
Ok(v) => v,
425425
Err(_) => vec![(0, 0.0)],
426426
}
@@ -606,7 +606,7 @@ async fn update_chunk(
606606
.map_err(|_| ServiceError::BadRequest("chunk not found".into()))?;
607607

608608
let splade_vector = if server_dataset_config.FULLTEXT_ENABLED {
609-
match get_splade_embedding(&content, "doc").await {
609+
match get_sparse_vector(&content, "doc").await {
610610
Ok(v) => v,
611611
Err(_) => vec![(0, 0.0)],
612612
}

server/src/handlers/chunk_handler.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1286,6 +1286,7 @@ pub async fn search_chunk(
12861286
pool,
12871287
dataset_org_plan_sub.dataset,
12881288
server_dataset_config,
1289+
&mut timer,
12891290
)
12901291
.await?
12911292
}
@@ -1297,6 +1298,7 @@ pub async fn search_chunk(
12971298
pool,
12981299
dataset_org_plan_sub.dataset,
12991300
server_dataset_config,
1301+
&mut timer,
13001302
)
13011303
.await?
13021304
}
@@ -1307,8 +1309,8 @@ pub async fn search_chunk(
13071309
page,
13081310
pool,
13091311
dataset_org_plan_sub.dataset,
1310-
&mut timer,
13111312
server_dataset_config,
1313+
&mut timer,
13121314
)
13131315
.await?
13141316
}

server/src/operators/model_operator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ pub struct CustomSparseEmbedData {
164164
}
165165

166166
#[tracing::instrument]
167-
pub async fn get_splade_embedding(
167+
pub async fn get_sparse_vector(
168168
message: &str,
169169
embed_type: &str,
170170
) -> Result<Vec<(u32, f32)>, ServiceError> {

0 commit comments

Comments
 (0)