@pintahub/database-schemas 4.7.2 → 4.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/schemas/Product.js +69 -0
package/package.json
CHANGED
package/schemas/Product.js
CHANGED
|
@@ -403,5 +403,74 @@ Product.index({
|
|
|
403
403
|
tags: 'text',
|
|
404
404
|
})
|
|
405
405
|
|
|
406
|
+
/**
|
|
407
|
+
* Atlas Search index for storefront `/products/v2/search`.
|
|
408
|
+
*
|
|
409
|
+
* Full-text scored fields: display_title (primary), tags, code.
|
|
410
|
+
* Other mappings are filter/sort-only — allows the storefront to combine
|
|
411
|
+
* the full query into a single $search stage (compound.must + compound.filter + sort).
|
|
412
|
+
*/
|
|
413
|
+
Product.searchIndex({
|
|
414
|
+
name: 'products_search',
|
|
415
|
+
definition: {
|
|
416
|
+
mappings: {
|
|
417
|
+
dynamic: false,
|
|
418
|
+
fields: {
|
|
419
|
+
// ---- Full-text searchable ----
|
|
420
|
+
display_title: {
|
|
421
|
+
type: 'string',
|
|
422
|
+
analyzer: 'lucene.english',
|
|
423
|
+
searchAnalyzer: 'lucene.english',
|
|
424
|
+
},
|
|
425
|
+
tags: [
|
|
426
|
+
{type: 'string', analyzer: 'lucene.english'},
|
|
427
|
+
{type: 'token', normalizer: 'lowercase'},
|
|
428
|
+
],
|
|
429
|
+
code: [
|
|
430
|
+
// Keyword analyzer: whole-string match (8-char SKU)
|
|
431
|
+
{type: 'string', analyzer: 'lucene.keyword'},
|
|
432
|
+
// Token: for $eq filter + $ne highlight exclusion
|
|
433
|
+
{type: 'token', normalizer: 'none'},
|
|
434
|
+
],
|
|
435
|
+
|
|
436
|
+
// ---- Tenant / scoping ----
|
|
437
|
+
store: {type: 'objectId'},
|
|
438
|
+
shop: {type: 'objectId'},
|
|
439
|
+
collections: {type: 'objectId'},
|
|
440
|
+
|
|
441
|
+
// ---- Enum/status filters ----
|
|
442
|
+
status: {type: 'token', normalizer: 'lowercase'},
|
|
443
|
+
visibility: {type: 'token', normalizer: 'lowercase'},
|
|
444
|
+
publications: {type: 'token', normalizer: 'lowercase'},
|
|
445
|
+
product_type: {type: 'token', normalizer: 'lowercase'},
|
|
446
|
+
|
|
447
|
+
// ---- Boolean ----
|
|
448
|
+
is_primary: {type: 'boolean'},
|
|
449
|
+
customizable: {type: 'boolean'},
|
|
450
|
+
|
|
451
|
+
// ---- Numeric filters & sort keys ----
|
|
452
|
+
sales_count: {type: 'number'},
|
|
453
|
+
views_count: {type: 'number'},
|
|
454
|
+
published_at: {type: 'date'},
|
|
455
|
+
|
|
456
|
+
// ---- Nested price_range ----
|
|
457
|
+
price_range: {
|
|
458
|
+
type: 'document',
|
|
459
|
+
dynamic: false,
|
|
460
|
+
fields: {
|
|
461
|
+
minVariantPrice: {
|
|
462
|
+
type: 'document',
|
|
463
|
+
dynamic: false,
|
|
464
|
+
fields: {
|
|
465
|
+
amount: {type: 'number'},
|
|
466
|
+
},
|
|
467
|
+
},
|
|
468
|
+
},
|
|
469
|
+
},
|
|
470
|
+
},
|
|
471
|
+
},
|
|
472
|
+
},
|
|
473
|
+
})
|
|
474
|
+
|
|
406
475
|
|
|
407
476
|
module.exports = Product
|