[feat] add Artist field, and name cleanup

This commit is contained in:
2026-02-19 16:04:34 -05:00
parent 493d0a72fa
commit 81b223ae65
5 changed files with 54 additions and 85 deletions

View File

@@ -8,9 +8,9 @@ async function createCollection(client: Client) {
// Delete the collection if it already exists to ensure a clean slate
try {
const response = await client.collections('cards').delete();
console.log(`Collection "cards" deleted successfully:`, response);
//console.log(`Collection "cards" deleted successfully:`, response);
} catch (error) {
console.error(`Error deleting collection "cards":`, error);
//console.error(`Error deleting collection "cards":`, error);
}
// Create the collection with the specified schema
@@ -30,6 +30,7 @@ async function createCollection(client: Client) {
{ name: 'cardType', type: 'string', facet: true },
{ name: 'energyType', type: 'string', facet: true },
{ name: 'number', type: 'string' },
{ name: 'Artist', type: 'string' },
],
default_sorting_field: 'productId',
});
@@ -59,6 +60,7 @@ async function preloadSearchIndex() {
cardType: card.cardType || "",
energyType: card.energyType || "",
number: card.number,
Artist: card.Artist || "",
})), { action: 'upsert' });
console.log(chalk.green('Search index preloaded with Pokémon cards.'));