diff --git a/client/src/app/pages/dashboard/search/SearchPage.tsx b/client/src/app/pages/dashboard/search/SearchPage.tsx
index 4b472b9d1..3ec1dc548 100644
--- a/client/src/app/pages/dashboard/search/SearchPage.tsx
+++ b/client/src/app/pages/dashboard/search/SearchPage.tsx
@@ -206,7 +206,6 @@ function ChartView({
- | {d.song.__textScore} |
{d.playcount} |
)}
diff --git a/server/src/lib/search/search.test.ts b/server/src/lib/search/search.test.ts
index 92c712d23..f9ce7c639 100644
--- a/server/src/lib/search/search.test.ts
+++ b/server/src/lib/search/search.test.ts
@@ -28,7 +28,28 @@ t.test("#SearchSpecificGameSongs", (t) => {
// songID here and expect this.
t.strictSame(
res.sort((a, b) => a.id - b.id).map((e) => e.title),
- ["A", "AA", "冥", "F", "HAERETICUS", "ZZ", "X", "AA -rebuild-", "∀", "-65℃"]
+ [
+ "L'amour et la liberte",
+ "A",
+ "I'm In Love Again -Y&Co. EURO MIX-",
+ "AA",
+ "冥",
+ "Make Me Your Own",
+ "AIR RAID FROM THA UNDAGROUND",
+ "Programmed Sun (xac Antarctic Ocean mix)",
+ "黒髪乱れし修羅となりて",
+ "F",
+ "DON'T WAKE ME FROM THE DREAM (2010 Summer Edition)",
+ "HAERETICUS",
+ "狂イ咲ケ焔ノ華",
+ "ZZ",
+ "X",
+ "獅子霞麗ノ舞",
+ "AA -rebuild-",
+ "抱きしめてモナムール",
+ "∀",
+ "-65℃",
+ ]
);
t.end();
diff --git a/server/src/lib/search/search.ts b/server/src/lib/search/search.ts
index 21cb32fb4..a9a0c4d3b 100644
--- a/server/src/lib/search/search.ts
+++ b/server/src/lib/search/search.ts
@@ -1,3 +1,10 @@
+/* eslint-disable import/first */
+// see: https://www.npmjs.com/package/fix-esm
+// fzf *mandates* esm, but we don't use it (ts transpiles to cjs)
+// sick of this headache.
+// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires
+require("fix-esm").register();
+
import db from "external/mongo/db";
import { AsyncFzf } from "fzf";
import CreateLogCtx from "lib/logger/logger";
@@ -37,7 +44,7 @@ const SEARCH_CONTROLS = {
goals: { keys: ["name"], primary: "goalID" },
quests: { keys: ["name"], primary: "questID" },
users: { keys: ["username"], primary: "id" },
- folders: { keys: ["name", "searchTerms"], primary: "folderID" },
+ folders: { keys: ["title", "searchTerms"], primary: "folderID" },
} satisfies Partial>;
/**
@@ -78,9 +85,13 @@ export async function SearchCollection(
}
);
- const results = await fzf
- .find(search)
- .then((data) => data.filter((d) => d.score > 100));
+ let results = await fzf.find(search);
+
+ // filter out anything far from the best match
+ // 30 was chosen arbitrarily :)
+ const max = results[0]?.score ?? 0;
+
+ results = results.filter((e) => e.score >= max - 30);
for (const res of results) {
const pkey = res.item[controls.primary];
diff --git a/server/src/main.ts b/server/src/main.ts
index 34c680380..3b768a80c 100644
--- a/server/src/main.ts
+++ b/server/src/main.ts
@@ -3,12 +3,6 @@
// we're running as a server, and not as a job runner or score worker.
process.env.IS_SERVER = "true";
-// see: https://www.npmjs.com/package/fix-esm
-// fzf *mandates* esm, but we don't use it (ts transpiles to cjs)
-// sick of this headache.
-// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires
-require("fix-esm").register();
-
import db, { monkDB } from "external/mongo/db";
import { UpdateIndexes } from "external/mongo/indexes";
import { InitSequenceDocs } from "external/mongo/sequence-docs";
diff --git a/server/src/test-utils/single-process-tap.ts b/server/src/test-utils/single-process-tap.ts
index 8dff6e4be..6e2d4e418 100644
--- a/server/src/test-utils/single-process-tap.ts
+++ b/server/src/test-utils/single-process-tap.ts
@@ -1,10 +1,3 @@
-/* eslint-disable import/first */
-// see: https://www.npmjs.com/package/fix-esm
-// fzf *mandates* esm, but we don't use it (ts transpiles to cjs)
-// sick of this headache.
-// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires
-require("fix-esm").register();
-
import "external/mongo/db";
import { CleanUpAfterTests } from "./cleanup";
import glob from "glob";