ddotthomas neon_arch commited on
Commit
d073aa2
1 Parent(s): 9f23a1c

♻️ refactor: start tracking page numbers from 0 instead of 1 in the backend (#467)

Browse files
Files changed (1) hide show
  1. src/server/routes/search.rs +3 -3
src/server/routes/search.rs CHANGED
@@ -59,11 +59,11 @@ pub async fn search(
59
  )
60
  };
61
 
62
- // .max(1) makes sure that the page > 0.
63
- let page = params.page.unwrap_or(1).max(1);
64
 
65
  let (_, results, _) = join!(
66
- get_results(page - 1),
67
  get_results(page),
68
  get_results(page + 1)
69
  );
 
59
  )
60
  };
61
 
62
+ // .max(1) makes sure that the page >= 0.
63
+ let page = params.page.unwrap_or(1).max(1) - 1;
64
 
65
  let (_, results, _) = join!(
66
+ get_results(page.saturating_sub(1)),
67
  get_results(page),
68
  get_results(page + 1)
69
  );