mirror of
https://github.com/captbaritone/webamp
synced 2024-11-22 07:40:51 +00:00
More search facets
This commit is contained in:
parent
b224b627e3
commit
0b1194eefd
@ -329,13 +329,24 @@ program
|
||||
"Refresh the data we keep about files within skin archives"
|
||||
)
|
||||
.option("--refresh-content-hash", "Refresh content hash")
|
||||
.option("--update-search-index", "Refresh content hash")
|
||||
.action(
|
||||
async ({
|
||||
uploadIaScreenshot,
|
||||
uploadMissingScreenshots,
|
||||
refreshArchiveFiles,
|
||||
refreshContentHash,
|
||||
updateSearchIndex,
|
||||
}) => {
|
||||
if (updateSearchIndex) {
|
||||
const ctx = new UserContext();
|
||||
const rows = await knex.raw(
|
||||
`SELECT md5, update_timestamp from skins LEFT JOIN algolia_field_updates ON skins.md5 = algolia_field_updates.skin_md5 GROUP BY md5 ORDER BY update_timestamp LIMIT ?;`,
|
||||
[100]
|
||||
);
|
||||
const md5s = rows.map((row) => row.md5);
|
||||
console.log(await Skins.updateSearchIndexs(ctx, md5s));
|
||||
}
|
||||
if (refreshContentHash) {
|
||||
const ctx = new UserContext();
|
||||
const skinRows = await knex("skins").select();
|
||||
|
@ -27,7 +27,6 @@ export default class FileInfoModel {
|
||||
}
|
||||
|
||||
getTextContent(): string | null {
|
||||
console.log("row", this.row);
|
||||
return this.row.text_content;
|
||||
}
|
||||
|
||||
|
@ -195,7 +195,6 @@ export default class SkinModel {
|
||||
if (readme == null) {
|
||||
return null;
|
||||
}
|
||||
console.log("readme", readme);
|
||||
return readme.getTextContent();
|
||||
}
|
||||
|
||||
@ -281,15 +280,17 @@ export default class SkinModel {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @returns
|
||||
*/
|
||||
async hasEqualizer(): Promise<boolean> {
|
||||
return this._hasSpriteSheet("EQMAIN");
|
||||
}
|
||||
async hasPlaylist(): Promise<boolean> {
|
||||
return this._hasSpriteSheet("PLEDIT");
|
||||
}
|
||||
async hasMediaLibrary(): Promise<boolean> {
|
||||
return this.hasGeneral();
|
||||
}
|
||||
|
||||
async hasMiniBrowser(): Promise<boolean> {
|
||||
async hasBrowser(): Promise<boolean> {
|
||||
return this._hasSpriteSheet("MB");
|
||||
}
|
||||
|
||||
|
@ -161,6 +161,17 @@ type SearchIndex = {
|
||||
nsfw: boolean;
|
||||
fileName: string;
|
||||
twitterLikes: number;
|
||||
equalizer: boolean;
|
||||
playlist: boolean;
|
||||
browser: boolean;
|
||||
general: boolean;
|
||||
video: boolean;
|
||||
cur: boolean;
|
||||
ani: boolean;
|
||||
transparency: boolean;
|
||||
mikro: boolean;
|
||||
vidamp: boolean;
|
||||
avs: boolean;
|
||||
};
|
||||
|
||||
async function getSearchIndexes(
|
||||
@ -187,6 +198,17 @@ async function getSearchIndexes(
|
||||
readmeText: readmeText ? truncate(readmeText, 4800) : null,
|
||||
fileName: await skin.getFileName(),
|
||||
twitterLikes: likes,
|
||||
equalizer: await skin.hasEqualizer(),
|
||||
playlist: await skin.hasPlaylist(),
|
||||
browser: await skin.hasBrowser(),
|
||||
general: await skin.hasGeneral(),
|
||||
video: await skin.hasVideo(),
|
||||
cur: await skin.hasCur(),
|
||||
ani: await skin.hasAni(),
|
||||
transparency: await skin.hasTransparency(),
|
||||
mikro: await skin.hasMikro(),
|
||||
vidamp: await skin.hasVidamp(),
|
||||
avs: await skin.hasAVS(),
|
||||
};
|
||||
})
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user