File tree 2 files changed +7
-8
lines changed 2 files changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -530,13 +530,7 @@ var upsertSearchStatement = fmt.Sprintf(`
530
530
AND p.version = m.version
531
531
WHERE
532
532
p.path = $1
533
- ORDER BY
534
- -- Order the versions by release then prerelease.
535
- -- The default version should be the first release
536
- -- version available, if one exists.
537
- m.version_type = 'release' DESC,
538
- m.sort_version DESC,
539
- m.module_path DESC
533
+ %s
540
534
LIMIT 1
541
535
ON CONFLICT (package_path)
542
536
DO UPDATE SET
@@ -556,7 +550,7 @@ var upsertSearchStatement = fmt.Sprintf(`
556
550
THEN search_documents.version_updated_at
557
551
ELSE CURRENT_TIMESTAMP
558
552
END)
559
- ;` , hllRegisterCount )
553
+ ;` , hllRegisterCount , orderByLatest )
560
554
561
555
// UpsertSearchDocuments adds search information for mod ot the search_documents table.
562
556
func UpsertSearchDocuments (ctx context.Context , db * database.DB , mod * internal.Module ) (err error ) {
Original file line number Diff line number Diff line change @@ -731,6 +731,11 @@ func TestUpsertSearchDocument(t *testing.T) {
731
731
}
732
732
733
733
insertModule ("v1.0.0" , false )
734
+
735
+ // Ensures the row updated in the search_document table for a given module
736
+ // is updated with a version that prefers non-incompatible modules. (The
737
+ // latest version after this insertion should remain v1.0.0)
738
+ insertModule ("v2.0.0+incompatible" , false )
734
739
sdOriginal := getSearchDocument ()
735
740
736
741
insertModule ("v0.5.0" , true )
You can’t perform that action at this time.
0 commit comments