mirror of
https://github.com/zkldi/Tachi.git
synced 2026-10-05 05:18:12 +03:00
Merge pull request #348 from TeamNewGuys:zkldi/issue-343-Folder-Tags
Add folder searchTerms
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
scripts
|
||||
src/**/*.test.ts
|
||||
src/test-utils
|
||||
+2
-1
@@ -32,4 +32,5 @@ test-cdn
|
||||
# Weird Redis Dumps
|
||||
dump.rdb
|
||||
|
||||
scripts/quick-insert/insert.ts
|
||||
scripts/quick-insert/insert.ts
|
||||
scripts/bpi-poyashi-data/output.json
|
||||
+1
-1
@@ -73,7 +73,7 @@
|
||||
"redis": "3.1.2",
|
||||
"rimraf": "3.0.2",
|
||||
"safe-json-stringify": "1.2.0",
|
||||
"tachi-common": "0.2.15",
|
||||
"tachi-common": "0.2.17",
|
||||
"typescript": "4.3.4",
|
||||
"winston": "3.3.3"
|
||||
},
|
||||
|
||||
Generated
+4
-4
@@ -54,7 +54,7 @@ specifiers:
|
||||
rimraf: 3.0.2
|
||||
safe-json-stringify: 1.2.0
|
||||
supertest: 6.1.3
|
||||
tachi-common: 0.2.15
|
||||
tachi-common: 0.2.17
|
||||
tap: 15.0.9
|
||||
ts-node: 10.0.0
|
||||
tsconfig-paths: 3.10.1
|
||||
@@ -88,7 +88,7 @@ dependencies:
|
||||
redis: 3.1.2
|
||||
rimraf: 3.0.2
|
||||
safe-json-stringify: 1.2.0
|
||||
tachi-common: 0.2.15
|
||||
tachi-common: 0.2.17
|
||||
typescript: 4.3.4
|
||||
winston: 3.3.3
|
||||
|
||||
@@ -3892,8 +3892,8 @@ packages:
|
||||
strip-ansi: 6.0.0
|
||||
dev: true
|
||||
|
||||
/tachi-common/0.2.15:
|
||||
resolution: {integrity: sha512-p7nt7pupl2JWNb20K7n18YOBtxUYeoyDsE6YbPVVyPvY1oj74a2YxALpmajGV2pbVAkdywrJS94In2sQUGzJtw==}
|
||||
/tachi-common/0.2.17:
|
||||
resolution: {integrity: sha512-Qnb6i7VLS6oyutO7iqpXdMhytrINZbXBChdoRbX87ubMH12fwzy67cVWQ2SmTot8JrEqhYCf9/lsZeghsDCT+g==}
|
||||
dependencies:
|
||||
monk: 7.3.4
|
||||
transitivePeerDependencies:
|
||||
|
||||
@@ -10,8 +10,8 @@ function ConvertFn(c: any): SongDocument<"chunithm"> {
|
||||
artist: c.artist,
|
||||
id: c.id,
|
||||
firstVersion: c.firstAppearance,
|
||||
"alt-titles": c["alt-titles"].filter((e: string) => e !== c.title),
|
||||
"search-titles": c["search-titles"]
|
||||
altTitles: c.altTitles.filter((e: string) => e !== c.title),
|
||||
searchTerms: c.searchTerms
|
||||
.map((e: string) => e.toString())
|
||||
.filter((e: string) => e !== c.title),
|
||||
data: {
|
||||
|
||||
@@ -10,8 +10,8 @@ function ConvertFn(c: any): SongDocument<"ddr"> {
|
||||
artist: c.artist,
|
||||
id: c.id,
|
||||
firstVersion: c.firstAppearance,
|
||||
"alt-titles": c["alt-titles"] ? c["alt-titles"].filter((e: string) => e !== c.title) : [],
|
||||
"search-titles": c["search-title"]
|
||||
altTitles: c.altTitles ? c.altTitles.filter((e: string) => e !== c.title) : [],
|
||||
searchTerms: c["search-title"]
|
||||
.filter((e: string) => !!e)
|
||||
.map((e: string) => e.toString())
|
||||
.filter((e: string) => e !== c.title),
|
||||
|
||||
@@ -9,8 +9,8 @@ function ConvertFn(c: any): SongDocument<"iidx"> {
|
||||
artist: c.artist,
|
||||
id: c.id,
|
||||
firstVersion: c.firstAppearance,
|
||||
"alt-titles": c["alt-titles"].filter((e: string) => e !== c.title),
|
||||
"search-titles": c["search-titles"]
|
||||
altTitles: c.altTitles.filter((e: string) => e !== c.title),
|
||||
searchTerms: c.searchTerms
|
||||
.map((e: string) => e.toString())
|
||||
.filter((e: string) => e !== c.title),
|
||||
data: {
|
||||
|
||||
@@ -9,8 +9,8 @@ function ConvertFn(c: any): SongDocument<"museca"> {
|
||||
artist: c.artist,
|
||||
id: c.id,
|
||||
firstVersion: c.firstAppearance,
|
||||
"alt-titles": [],
|
||||
"search-titles": [],
|
||||
altTitles: [],
|
||||
searchTerms: [],
|
||||
data: {
|
||||
titleJP: c.title_jp,
|
||||
artistJP: c.artist_jp,
|
||||
|
||||
@@ -9,8 +9,8 @@ function ConvertFn(c: any): SongDocument<"sdvx"> {
|
||||
artist: c.artist,
|
||||
id: c.id,
|
||||
firstVersion: c.firstAppearance,
|
||||
"alt-titles": c["alt-titles"].filter((e: string) => e !== c.title),
|
||||
"search-titles": c["search-titles"]
|
||||
altTitles: c.altTitles.filter((e: string) => e !== c.title),
|
||||
searchTerms: c.searchTerms
|
||||
.map((e: string) => e.toString())
|
||||
.filter((e: string) => e !== c.title),
|
||||
data: {
|
||||
|
||||
@@ -142,6 +142,7 @@ export async function UpdateTable(table: BMSTablesDataset) {
|
||||
playtype: table.playtype,
|
||||
type: "charts",
|
||||
data: query,
|
||||
searchTerms: [`${table.name} ${level}`],
|
||||
});
|
||||
|
||||
logger.info(`Inserted new table ${table.prefix}${level}.`);
|
||||
|
||||
File diff suppressed because one or more lines are too long
+1
-1
@@ -19,7 +19,7 @@ program.option("-f, --fetch", "Fetch the latest data from the poyashi repo.");
|
||||
program.parse(process.argv);
|
||||
const options = program.opts();
|
||||
|
||||
const dataLoc = path.join(__dirname, "./bpi-poyashi-data/output.json");
|
||||
const dataLoc = path.join(__dirname, "./output.json");
|
||||
|
||||
const difficultyResolve: Record<string, [string, string]> = {
|
||||
3: ["SP", "HYPER"],
|
||||
@@ -133,6 +133,7 @@ async function InsertStaticLevelVersionFolders() {
|
||||
title: `Level ${level} (${version})`,
|
||||
type: "charts",
|
||||
data: query,
|
||||
searchTerms: [],
|
||||
inactive,
|
||||
});
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import db from "../../src/external/mongo/db";
|
||||
import db from "external/mongo/db";
|
||||
import { Command } from "commander";
|
||||
import CreateLogCtx from "../../src/lib/logger/logger";
|
||||
import CreateLogCtx from "lib/logger/logger";
|
||||
import { Random20Hex } from "utils/misc";
|
||||
|
||||
const logger = CreateLogCtx(__filename);
|
||||
|
||||
@@ -12,7 +13,7 @@ program.parse(process.argv);
|
||||
const options = program.opts();
|
||||
|
||||
if (!options.code) {
|
||||
throw new Error(`No code specified.`);
|
||||
options.code = Random20Hex();
|
||||
}
|
||||
|
||||
db.invites
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
import db from "external/mongo/db";
|
||||
import CreateLogCtx from "lib/logger/logger";
|
||||
import { StaticConfig } from "tachi-common";
|
||||
|
||||
const logger = CreateLogCtx(__filename);
|
||||
|
||||
(async () => {
|
||||
for (const game of StaticConfig.allSupportedGames) {
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
await db.songs[game].update(
|
||||
{},
|
||||
{ $rename: { "alt-titles": "altTitles", "search-titles": "searchTerms" } },
|
||||
{ multi: true }
|
||||
);
|
||||
|
||||
logger.info(`Refactored title names for ${game}.`);
|
||||
}
|
||||
|
||||
logger.info(`Done.`);
|
||||
process.exit(0);
|
||||
})();
|
||||
Vendored
+3
-3
@@ -61,7 +61,7 @@ const staticIndexes: Partial<Record<Databases, Index[]>> = {
|
||||
index({ game: 1, playtype: 1 }),
|
||||
index({ game: 1, playtype: 1, table: 1 }),
|
||||
index({ game: 1, playtype: 1, table: 1, tableIndex: 1 }),
|
||||
index({ title: "text" }),
|
||||
index({ title: "text", searchTerms: "text" }),
|
||||
],
|
||||
"kai-auth-tokens": [index({ userID: 1, service: 1 }, UNIQUE)],
|
||||
"charts-iidx": [
|
||||
@@ -106,13 +106,13 @@ for (const game of ServerTypeInfo.supportedGames) {
|
||||
if (indexes[`songs-${game}` as Databases]) {
|
||||
indexes[`songs-${game}` as Databases]!.push(
|
||||
index({ id: 1 }, UNIQUE),
|
||||
index({ title: "text", artist: "text", "alt-titles": "text", "search-titles": "text" })
|
||||
index({ title: "text", artist: "text", altTitles: "text", searchTerms: "text" })
|
||||
);
|
||||
} else {
|
||||
indexes[`songs-${game}` as Databases] = [
|
||||
index({ id: 1 }, UNIQUE),
|
||||
index({ title: 1 }),
|
||||
index({ title: "text", artist: "text", "alt-titles": "text", "search-titles": "text" }),
|
||||
index({ title: "text", artist: "text", altTitles: "text", searchTerms: "text" }),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -365,8 +365,8 @@ const PRUDENCE_SONG_BASE: PrudenceSchema = {
|
||||
id: p.isPositiveInteger,
|
||||
title: "string",
|
||||
artist: "string",
|
||||
"search-titles": [p.and("string", (self, parent) => self !== parent.title)],
|
||||
"alt-titles": [p.and("string", (self, parent) => self !== parent.title)],
|
||||
searchTerms: [p.and("string", (self, parent) => self !== parent.title)],
|
||||
altTitles: [p.and("string", (self, parent) => self !== parent.title)],
|
||||
firstVersion: "string",
|
||||
};
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@ t.test("#ConverterIRBarbatos", (t) => {
|
||||
artist: "無力P",
|
||||
id: 1,
|
||||
firstVersion: "booth",
|
||||
"alt-titles": [],
|
||||
"search-titles": ["albida_muryoku", "アルビダパワーレスミックス"],
|
||||
altTitles: [],
|
||||
searchTerms: ["albida_muryoku", "アルビダパワーレスミックス"],
|
||||
data: {
|
||||
uscEquiv: null,
|
||||
},
|
||||
|
||||
@@ -187,8 +187,8 @@ function ConvertBeatorajaChartToTachi(chart: BeatorajaChart) {
|
||||
title: chart.title,
|
||||
firstVersion: "",
|
||||
id: 0,
|
||||
"alt-titles": [],
|
||||
"search-titles": [],
|
||||
altTitles: [],
|
||||
searchTerms: [],
|
||||
data: {
|
||||
genre: chart.genre,
|
||||
subartist: chart.subartist,
|
||||
|
||||
@@ -14,8 +14,8 @@ t.test("#SearchGameSongs", (t) => {
|
||||
{
|
||||
title: "text",
|
||||
artist: "text",
|
||||
"alt-titles": "text",
|
||||
"search-titles": "text",
|
||||
altTitles: "text",
|
||||
searchTerms: "text",
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
} as any /* known bug with monk */
|
||||
);
|
||||
|
||||
@@ -17,6 +17,7 @@ const mockFolder: FolderDocument = {
|
||||
level: "10",
|
||||
},
|
||||
type: "charts",
|
||||
searchTerms: [],
|
||||
inactive: false,
|
||||
};
|
||||
|
||||
|
||||
@@ -562,8 +562,8 @@ t.test("POST /scores", async (t) => {
|
||||
artist: "test_artist",
|
||||
firstVersion: null,
|
||||
id: 0,
|
||||
"alt-titles": [],
|
||||
"search-titles": [],
|
||||
altTitles: [],
|
||||
searchTerms: [],
|
||||
data: {},
|
||||
});
|
||||
|
||||
|
||||
@@ -226,8 +226,8 @@ export function ConvertUSCChart(uscChartDoc: USCClientChart) {
|
||||
firstVersion: null,
|
||||
id: 0,
|
||||
data: {},
|
||||
"alt-titles": [],
|
||||
"search-titles": [],
|
||||
altTitles: [],
|
||||
searchTerms: [],
|
||||
};
|
||||
|
||||
return { chart, song };
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
"subartist": null,
|
||||
"genre": "ELECTRANCE"
|
||||
},
|
||||
"search-titles": [],
|
||||
"alt-titles": []
|
||||
"searchTerms": [],
|
||||
"altTitles": []
|
||||
}
|
||||
]
|
||||
@@ -3,8 +3,8 @@
|
||||
"artist": "nora2r",
|
||||
"id": 3,
|
||||
"firstVersion": "chuni",
|
||||
"alt-titles": [],
|
||||
"search-titles": [],
|
||||
"altTitles": [],
|
||||
"searchTerms": [],
|
||||
"data": {
|
||||
"genre": "VARIETY"
|
||||
}
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
"artist": "UZI-LAY",
|
||||
"id": 10,
|
||||
"firstVersion": "2",
|
||||
"alt-titles": [],
|
||||
"search-titles": [
|
||||
"altTitles": [],
|
||||
"searchTerms": [
|
||||
"putyourfaithinme"
|
||||
],
|
||||
"data": {}
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
"artist": "dj nagureo",
|
||||
"id": 1,
|
||||
"firstVersion": "0",
|
||||
"alt-titles": [],
|
||||
"search-titles": [],
|
||||
"altTitles": [],
|
||||
"searchTerms": [],
|
||||
"data": {
|
||||
"genre": "PIANO AMBIENT"
|
||||
}
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
"artist": "無力P",
|
||||
"id": 1,
|
||||
"firstVersion": "booth",
|
||||
"alt-titles": [],
|
||||
"search-titles": [
|
||||
"altTitles": [],
|
||||
"searchTerms": [
|
||||
"albida_muryoku",
|
||||
"アルビダパワーレスミックス"
|
||||
],
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
"artist": "無力P",
|
||||
"id": 1,
|
||||
"firstVersion": null,
|
||||
"alt-titles": [],
|
||||
"search-titles": [],
|
||||
"altTitles": [],
|
||||
"searchTerms": [],
|
||||
"data": {}
|
||||
}
|
||||
]
|
||||
@@ -114,6 +114,7 @@ export const TestingIIDXFolderSP10: FolderDocument = {
|
||||
level: "10",
|
||||
"flags¬IN BASE GAME": true,
|
||||
},
|
||||
searchTerms: [],
|
||||
inactive: false,
|
||||
};
|
||||
|
||||
|
||||
@@ -8,6 +8,6 @@
|
||||
"subartist": null,
|
||||
"genre": "ELECTRANCE"
|
||||
},
|
||||
"search-titles": [],
|
||||
"alt-titles": []
|
||||
"searchTerms": [],
|
||||
"altTitles": []
|
||||
}
|
||||
@@ -3,8 +3,8 @@
|
||||
"artist": "nora2r",
|
||||
"id": 3,
|
||||
"firstVersion": "chuni",
|
||||
"alt-titles": [],
|
||||
"search-titles": [],
|
||||
"altTitles": [],
|
||||
"searchTerms": [],
|
||||
"data": {
|
||||
"genre": "VARIETY"
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
"artist": "UZI-LAY",
|
||||
"id": 10,
|
||||
"firstVersion": "2",
|
||||
"alt-titles": [],
|
||||
"search-titles": [
|
||||
"altTitles": [],
|
||||
"searchTerms": [
|
||||
"putyourfaithinme"
|
||||
],
|
||||
"data": {}
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
"artist": "dj nagureo",
|
||||
"id": 1,
|
||||
"firstVersion": "0",
|
||||
"alt-titles": [],
|
||||
"search-titles": [],
|
||||
"altTitles": [],
|
||||
"searchTerms": [],
|
||||
"data": {
|
||||
"genre": "PIANO AMBIENT"
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
"artist": "無力P",
|
||||
"id": 1,
|
||||
"firstVersion": "booth",
|
||||
"alt-titles": [],
|
||||
"search-titles": [
|
||||
"altTitles": [],
|
||||
"searchTerms": [
|
||||
"albida_muryoku",
|
||||
"アルビダパワーレスミックス"
|
||||
],
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -21,7 +21,7 @@ export function FindSongOnTitle(game: Game, title: string): Promise<FindOneResul
|
||||
title: title,
|
||||
},
|
||||
{
|
||||
"alt-titles": title,
|
||||
altTitles: title,
|
||||
},
|
||||
],
|
||||
});
|
||||
@@ -44,7 +44,7 @@ export function FindSongOnTitleInsensitive(
|
||||
title: { $regex: regex },
|
||||
},
|
||||
{
|
||||
"alt-titles": { $regex: regex },
|
||||
altTitles: { $regex: regex },
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user