[feat] add Artist field, and name cleanup
This commit is contained in:
@@ -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.'));
|
||||
|
||||
Reference in New Issue
Block a user