diff --git a/assets/views/shop/_search.html b/assets/views/shop/_search.html index 2046bc5..ec8d86e 100644 --- a/assets/views/shop/_search.html +++ b/assets/views/shop/_search.html @@ -57,7 +57,7 @@ {{ t(key="sort-label", lang=L) }} diff --git a/src/controllers/shop.rs b/src/controllers/shop.rs index b0932e6..518b494 100644 --- a/src/controllers/shop.rs +++ b/src/controllers/shop.rs @@ -164,13 +164,13 @@ async fn run_search( let filter = view::category_filter_ids(&all_categories, &selected_category); items.retain(|i| view::category_filter_keep(&filter, i.product.category_id)); - // 6. Sort. Relevance is the default; with no text query it keeps the base - // order (newest-first), and with a query it keeps the ranked search order. + // 6. Sort. Newest-first is the default; relevance (the ranked search order) + // is available explicitly via the sort control. let sort = params .sort .clone() .filter(|s| !s.is_empty()) - .unwrap_or_else(|| "relevance".to_string()); + .unwrap_or_else(|| "newest".to_string()); match sort.as_str() { "price_asc" => items.sort_by(|a, b| a.priced.price_cents.cmp(&b.priced.price_cents)), "price_desc" => items.sort_by(|a, b| b.priced.price_cents.cmp(&a.priced.price_cents)),