- 点击文档条目时,跳转到对应的download路由 - 修改搜索条目转换逻辑,将product_documents类型条目的id有product_document的id改为文件uuid
36 lines
850 B
TypeScript
36 lines
850 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: item.content.slice(0, 100) + '...',
|
|
}),
|
|
|
|
product_documents: (
|
|
item: MeiliIndexMap['product_documents']
|
|
): SearchItemView => ({
|
|
id: item.fileUUID || item.id,
|
|
type: 'document',
|
|
title: item.title,
|
|
}),
|
|
};
|