|
1
|
import { SearchTypes } from "@medusajs/framework/types" |
|
2
|
|
|
3
|
export const products: SearchTypes.SearchDocument[] = [ |
|
4
|
{ |
|
5
|
id: "prod_medusa_1", |
|
6
|
title: "Red running shoe", |
|
7
|
status: "published", |
|
8
|
price: 100, |
|
9
|
tags: ["shoe", "sport"], |
|
10
|
}, |
|
11
|
{ |
|
12
|
id: "prod_medusa_2", |
|
13
|
title: "Blue running shirt", |
|
14
|
status: "published", |
|
15
|
price: 50, |
|
16
|
tags: ["shirt", "sport"], |
|
17
|
}, |
|
18
|
] |
|
19
|
|
|
20
|
export const productIndex: SearchTypes.SearchIndexDefinition = { |
|
21
|
name: `medusa_product_${Date.now()}`, |
|
22
|
entity: "product", |
|
23
|
provider: "search-medusa", |
|
24
|
fields: { |
|
25
|
id: { type: "keyword", filterable: true }, |
|
26
|
title: { type: "text", searchable: true }, |
|
27
|
status: { type: "keyword", filterable: true, facetable: true }, |
|
28
|
price: { type: "float", filterable: true, sortable: true }, |
|
29
|
tags: { type: "keyword", array: true, filterable: true, facetable: true }, |
|
30
|
}, |
|
31
|
async *seed() { |
|
32
|
yield products |
|
33
|
}, |
|
34
|
} |