fix(db): add stable tiebreaker to search pagination
Without a deterministic tiebreaker on skill ID, offset-based pagination through large groups of skills with identical star counts produced non-deterministic ordering. This caused ~1,516 skills to be missed during Meilisearch sync (192,311 sent but only 190,795 unique indexed). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -164,7 +164,7 @@ export const skillQueries = {
|
|||||||
? and(eq(skillCategories.categoryId, category), ...conditions)
|
? and(eq(skillCategories.categoryId, category), ...conditions)
|
||||||
: eq(skillCategories.categoryId, category)
|
: eq(skillCategories.categoryId, category)
|
||||||
)
|
)
|
||||||
.orderBy(primaryOrder, desc(secondaryColumn))
|
.orderBy(primaryOrder, desc(secondaryColumn), asc(skills.id))
|
||||||
.limit(limit)
|
.limit(limit)
|
||||||
.offset(offset);
|
.offset(offset);
|
||||||
|
|
||||||
@@ -175,7 +175,7 @@ export const skillQueries = {
|
|||||||
.select()
|
.select()
|
||||||
.from(skills)
|
.from(skills)
|
||||||
.where(conditions.length > 0 ? and(...conditions) : undefined)
|
.where(conditions.length > 0 ? and(...conditions) : undefined)
|
||||||
.orderBy(primaryOrder, desc(secondaryColumn))
|
.orderBy(primaryOrder, desc(secondaryColumn), asc(skills.id))
|
||||||
.limit(limit)
|
.limit(limit)
|
||||||
.offset(offset);
|
.offset(offset);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user