@@ -527,13 +527,14 @@ impl<RT: Runtime> Searcher for SearcherImpl<RT> {
527
527
search_storage : Arc < dyn Storage > ,
528
528
storage_key : ObjectKey ,
529
529
) -> anyhow:: Result < usize > {
530
- let _timer = text_number_of_segments_searcher_latency_seconds ( ) ;
530
+ let timer = text_number_of_segments_searcher_latency_seconds ( ) ;
531
531
let segment_path = self
532
532
. archive_cache
533
533
. get ( search_storage. clone ( ) , & storage_key, SearchFileType :: Text )
534
534
. await ?;
535
535
let reader = index_reader_for_directory ( segment_path) ?;
536
536
let searcher = reader. searcher ( ) ;
537
+ timer. finish ( ) ;
537
538
Ok ( searcher. segment_readers ( ) . len ( ) )
538
539
}
539
540
@@ -545,10 +546,11 @@ impl<RT: Runtime> Searcher for SearcherImpl<RT> {
545
546
queries : Vec < TokenQuery > ,
546
547
max_results : usize ,
547
548
) -> anyhow:: Result < Vec < TokenMatch > > {
548
- let _timer = text_query_tokens_searcher_latency_seconds ( ) ;
549
+ let timer = text_query_tokens_searcher_latency_seconds ( ) ;
549
550
let text_segment = self . load_text_segment ( search_storage, storage_keys) . await ?;
550
551
let query = move || Self :: query_tokens_impl ( text_segment, queries, max_results) ;
551
552
let resp = self . text_search_pool . execute ( query) . await ??;
553
+ timer. finish ( ) ;
552
554
Ok ( resp)
553
555
}
554
556
@@ -559,10 +561,11 @@ impl<RT: Runtime> Searcher for SearcherImpl<RT> {
559
561
storage_keys : TextStorageKeys ,
560
562
terms : Vec < Term > ,
561
563
) -> anyhow:: Result < Bm25Stats > {
562
- let _timer = text_query_bm25_searcher_latency_seconds ( ) ;
564
+ let timer = text_query_bm25_searcher_latency_seconds ( ) ;
563
565
let text_segment = self . load_text_segment ( search_storage, storage_keys) . await ?;
564
566
let query = move || Self :: query_bm25_stats_impl ( text_segment, terms) ;
565
567
let resp = self . text_search_pool . execute ( query) . await ??;
568
+ timer. finish ( ) ;
566
569
Ok ( resp)
567
570
}
568
571
@@ -573,10 +576,11 @@ impl<RT: Runtime> Searcher for SearcherImpl<RT> {
573
576
storage_keys : TextStorageKeys ,
574
577
query : PostingListQuery ,
575
578
) -> anyhow:: Result < Vec < PostingListMatch > > {
576
- let _timer = text_query_posting_lists_searcher_latency_seconds ( ) ;
579
+ let timer = text_query_posting_lists_searcher_latency_seconds ( ) ;
577
580
let text_segment = self . load_text_segment ( search_storage, storage_keys) . await ?;
578
581
let query = move || Self :: query_posting_lists_impl ( text_segment, query) ;
579
582
let resp = self . text_search_pool . execute ( query) . await ??;
583
+ timer. finish ( ) ;
580
584
Ok ( resp)
581
585
}
582
586
@@ -586,15 +590,17 @@ impl<RT: Runtime> Searcher for SearcherImpl<RT> {
586
590
search_storage : Arc < dyn Storage > ,
587
591
segments : Vec < FragmentedTextStorageKeys > ,
588
592
) -> anyhow:: Result < FragmentedTextSegment > {
589
- let _timer = text_compaction_searcher_latency_seconds ( ) ;
590
- fetch_compact_and_upload_text_segment (
593
+ let timer = text_compaction_searcher_latency_seconds ( ) ;
594
+ let result = fetch_compact_and_upload_text_segment (
591
595
& self . rt ,
592
596
search_storage,
593
597
self . archive_cache . clone ( ) ,
594
598
self . text_search_pool . clone ( ) ,
595
599
segments,
596
600
)
597
- . await
601
+ . await ;
602
+ timer. finish ( ) ;
603
+ result
598
604
}
599
605
}
600
606
0 commit comments