File tree 1 file changed +8
-8
lines changed
1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -499,13 +499,6 @@ impl_axum_webpage! {
499
499
status = |search| search. status,
500
500
}
501
501
502
- fn retrive_sort_from_paginate ( query : & str ) -> String {
503
- static RE : Lazy < Regex > = Lazy :: new ( || Regex :: new ( r"[?&]sort=([^&]+)" ) . unwrap ( ) ) ;
504
- let cap = RE . captures ( query) . unwrap ( ) ;
505
- cap. get ( 1 )
506
- . map_or ( "relevance" . to_string ( ) , |v| v. as_str ( ) . to_string ( ) )
507
- }
508
-
509
502
pub ( crate ) async fn search_handler (
510
503
mut conn : DbConnection ,
511
504
Extension ( pool) : Extension < Pool > ,
@@ -586,7 +579,14 @@ pub(crate) async fn search_handler(
586
579
) ;
587
580
return Err ( AxumNope :: NoResults ) ;
588
581
}
589
- sort_by = retrive_sort_from_paginate ( & query_params) ;
582
+
583
+ static RE : Lazy < Regex > = Lazy :: new ( || Regex :: new ( r"[?&]sort=([^&]+)" ) . unwrap ( ) ) ;
584
+ if let Some ( cap) = RE . captures ( & query_params) {
585
+ sort_by = cap
586
+ . get ( 1 )
587
+ . map_or ( "relevance" . to_string ( ) , |v| v. as_str ( ) . to_string ( ) ) ;
588
+ }
589
+
590
590
get_search_results ( & mut conn, & config, & query_params) . await ?
591
591
} else if !query. is_empty ( ) {
592
592
let query_params: String = form_urlencoded:: Serializer :: new ( String :: new ( ) )
You can’t perform that action at this time.
0 commit comments