File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -499,13 +499,6 @@ impl_axum_webpage! {
499499 status = |search| search. status,
500500}
501501
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-
509502pub ( crate ) async fn search_handler (
510503 mut conn : DbConnection ,
511504 Extension ( pool) : Extension < Pool > ,
@@ -586,7 +579,14 @@ pub(crate) async fn search_handler(
586579 ) ;
587580 return Err ( AxumNope :: NoResults ) ;
588581 }
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+
590590 get_search_results ( & mut conn, & config, & query_params) . await ?
591591 } else if !query. is_empty ( ) {
592592 let query_params: String = form_urlencoded:: Serializer :: new ( String :: new ( ) )
You can’t perform that action at this time.
0 commit comments