All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m7s
- 将meilisearch搜索服务移至Server端
37 lines
835 B
TypeScript
37 lines
835 B
TypeScript
/**
|
|
* 各索引对应的转换函数表
|
|
*/
|
|
export const converters: {
|
|
[K in keyof MeiliIndexMap]: (item: MeiliIndexMap[K]) => SearchItemView;
|
|
} = {
|
|
products: (item: MeiliIndexMap['products']): SearchItemView => ({
|
|
id: item.id,
|
|
type: 'product',
|
|
title: item.name,
|
|
summary: item.summary,
|
|
}),
|
|
|
|
solutions: (item: MeiliIndexMap['solutions']): SearchItemView => ({
|
|
id: item.id,
|
|
type: 'solution',
|
|
title: item.title,
|
|
summary: item.summary,
|
|
}),
|
|
|
|
questions: (item: MeiliIndexMap['questions']): SearchItemView => ({
|
|
id: item.id,
|
|
type: 'question',
|
|
title: item.title,
|
|
summary: '',
|
|
}),
|
|
|
|
product_documents: (
|
|
item: MeiliIndexMap['product_documents']
|
|
): SearchItemView => ({
|
|
id: item.fileUUID || item.id,
|
|
type: 'document',
|
|
title: item.title,
|
|
summary: '',
|
|
}),
|
|
};
|