authorgravatar for julius0216@outlook.comJulius Marminge <julius0216@outlook.com> 2026-09-05 01:20:09-07:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-09-05 01:20:09-07:00
log86f079964b9c3d2a087907d2ef8273c3dbcb960b
tree140b807bc8e462cc440c1753029085d58e6e1178
parentf5d9d12026d98b2b4b975f1944e7503d6c2c9eb3
signature Signed by PGP key B5690EEEBB952194

refactor(shared): keep search ranking comparator private (#10031)


2 files changed, 1 insertions(+), 3 deletions(-)

packages/shared/src/searchRanking.test.ts-2
......@@ -1,7 +1,6 @@
11import { describe, expect, it } from "vite-plus/test";
22
33import {
4 compareRankedSearchResults,
54 insertRankedSearchResult,
65 normalizeSearchQuery,
76 scoreQueryMatch,
......@@ -90,6 +89,5 @@ describe("insertRankedSearchResult", () => {
9089 insertRankedSearchResult(ranked, { item: "c", score: 30, tieBreaker: "c" }, 2);
9190
9291 expect(ranked.map((entry) => entry.item)).toEqual(["a", "b"]);
93 expect(compareRankedSearchResults(ranked[0]!, ranked[1]!)).toBeLessThan(0);
9492 });
9593});
packages/shared/src/searchRanking.ts+1-1
......@@ -135,7 +135,7 @@ export function scoreQueryMatch(input: {
135135 return null;
136136}
137137
138export function compareRankedSearchResults<T>(
138function compareRankedSearchResults<T>(
139139 left: RankedSearchResult<T>,
140140 right: RankedSearchResult<T>,
141141): number {