@@ -462,12 +462,18 @@ impl FilterParams {
462
462
let conditions: Vec < BoxedCondition < ' _ > > = match * seek_payload {
463
463
SeekPayload :: Name ( Name { id } ) => {
464
464
// Equivalent of:
465
- // `WHERE name > name'`
465
+ // ```
466
+ // WHERE name > name'
467
+ // ORDER BY name ASC
468
+ // ```
466
469
vec ! [ Box :: new( crates:: name. nullable( ) . gt( crate_name_by_id( id) ) ) ]
467
470
}
468
471
SeekPayload :: New ( New { created_at, id } ) => {
469
472
// Equivalent of:
470
- // `WHERE (created_at = created_at' AND id < id') OR created_at < created_at'`
473
+ // ```
474
+ // WHERE (created_at = created_at' AND id < id') OR created_at < created_at'
475
+ // ORDER BY created_at DESC, id DESC
476
+ // ```
471
477
vec ! [
472
478
Box :: new(
473
479
crates:: created_at
@@ -480,7 +486,10 @@ impl FilterParams {
480
486
}
481
487
SeekPayload :: RecentUpdates ( RecentUpdates { updated_at, id } ) => {
482
488
// Equivalent of:
483
- // `WHERE (updated_at = updated_at' AND id < id') OR updated_at < updated_at'`
489
+ // ```
490
+ // WHERE (updated_at = updated_at' AND id < id') OR updated_at < updated_at'
491
+ // ORDER BY updated_at DESC, id DESC
492
+ // ```
484
493
vec ! [
485
494
Box :: new(
486
495
crates:: updated_at
@@ -497,10 +506,16 @@ impl FilterParams {
497
506
} ) => {
498
507
// Equivalent of:
499
508
// for recent_downloads is not None:
500
- // `WHERE (recent_downloads = recent_downloads' AND id < id')
501
- // OR (recent_downloads < recent_downloads' OR recent_downloads IS NULL)`
509
+ // ```
510
+ // WHERE (recent_downloads = recent_downloads' AND id < id')
511
+ // OR (recent_downloads < recent_downloads' OR recent_downloads IS NULL)
512
+ // ORDER BY recent_downloads DESC NULLS LAST, id DESC
513
+ // ```
502
514
// for recent_downloads is None:
503
- // `WHERE (recent_downloads IS NULL AND id < id')`
515
+ // ```
516
+ // WHERE (recent_downloads IS NULL AND id < id')
517
+ // ORDER BY recent_downloads DESC NULLS LAST, id DESC
518
+ // ```
504
519
match recent_downloads {
505
520
Some ( dl) => {
506
521
vec ! [
@@ -530,7 +545,10 @@ impl FilterParams {
530
545
}
531
546
SeekPayload :: Downloads ( Downloads { downloads, id } ) => {
532
547
// Equivalent of:
533
- // `WHERE (downloads = downloads' AND id < id') OR downloads < downloads'`
548
+ // ```
549
+ // WHERE (downloads = downloads' AND id < id') OR downloads < downloads'
550
+ // ORDER BY downloads DESC, id DESC
551
+ // ```
534
552
vec ! [
535
553
Box :: new(
536
554
crate_downloads:: downloads
@@ -543,8 +561,10 @@ impl FilterParams {
543
561
}
544
562
SeekPayload :: Query ( Query { exact_match, id } ) => {
545
563
// Equivalent of:
546
- // `WHERE (exact_match = exact_match' AND name < name') OR exact_match <
547
- // exact_match'`
564
+ // ```
565
+ // WHERE (exact_match = exact_match' AND name > name') OR exact_match < exact_match'
566
+ // ORDER BY exact_match DESC, NAME ASC
567
+ // ```
548
568
let q_string = self . q_string . as_ref ( ) . expect ( "q_string should not be None" ) ;
549
569
let name_exact_match = Crate :: with_name ( q_string) ;
550
570
vec ! [
@@ -563,9 +583,12 @@ impl FilterParams {
563
583
id,
564
584
} ) => {
565
585
// Equivalent of:
566
- // `WHERE (exact_match = exact_match' AND rank = rank' AND name > name')
586
+ // ```
587
+ // WHERE (exact_match = exact_match' AND rank = rank' AND name > name')
567
588
// OR (exact_match = exact_match' AND rank < rank')
568
- // OR exact_match < exact_match'`
589
+ // OR exact_match < exact_match'
590
+ // ORDER BY exact_match DESC, rank DESC, name ASC
591
+ // ```
569
592
let q_string = self . q_string . as_ref ( ) . expect ( "q_string should not be None" ) ;
570
593
let q = sql :: < TsQuery > ( "plainto_tsquery('english', " )
571
594
. bind :: < Text , _ > ( q_string. as_str ( ) )
0 commit comments