From 63491fd5f9b9f6dcc9ba759dbce2a5170c550fae Mon Sep 17 00:00:00 2001 From: R2m1liA <15258427350@163.com> Date: Thu, 30 Oct 2025 13:43:00 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E6=96=87=E6=A1=A3=E8=B7=AF=E7=94=B1=E8=B7=B3?= =?UTF-8?q?=E8=BD=AC=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 点击文档条目时,跳转到对应的download路由 - 修改搜索条目转换逻辑,将product_documents类型条目的id有product_document的id改为文件uuid --- app/components/pages/search/SearchResults.vue | 4 ++++ app/models/utils/search-converter.test.ts | 3 ++- app/models/utils/search-converters.ts | 2 +- app/models/views/SearchItemView.ts | 2 +- shared/types/meilisearch/meili-index.ts | 3 +++ shared/types/meilisearch/search-result.ts | 1 + 6 files changed, 12 insertions(+), 3 deletions(-) diff --git a/app/components/pages/search/SearchResults.vue b/app/components/pages/search/SearchResults.vue index f130410..5c01635 100644 --- a/app/components/pages/search/SearchResults.vue +++ b/app/components/pages/search/SearchResults.vue @@ -124,6 +124,10 @@ return localePath({ path: `/solutions/${slug}` }); } + if (item.type === 'document') { + return localePath({ path: `/download/${slug}` }); + } + return null; }; diff --git a/app/models/utils/search-converter.test.ts b/app/models/utils/search-converter.test.ts index e9d9947..5e079ab 100644 --- a/app/models/utils/search-converter.test.ts +++ b/app/models/utils/search-converter.test.ts @@ -63,10 +63,11 @@ describe('converters', () => { title: 'User Manual', products: ['Product A'], product_types: ['Type A'], + fileUUID: 'TEST-UUID', }; const result = converters.product_documents(item); expect(result).toEqual({ - id: 1, + id: 'TEST-UUID', title: 'User Manual', summary: undefined, type: 'document', diff --git a/app/models/utils/search-converters.ts b/app/models/utils/search-converters.ts index c230e5f..f8714ec 100644 --- a/app/models/utils/search-converters.ts +++ b/app/models/utils/search-converters.ts @@ -28,7 +28,7 @@ export const converters: { product_documents: ( item: MeiliIndexMap['product_documents'] ): SearchItemView => ({ - id: item.id, + id: item.fileUUID || item.id, type: 'document', title: item.title, }), diff --git a/app/models/views/SearchItemView.ts b/app/models/views/SearchItemView.ts index 28b7822..5851292 100644 --- a/app/models/views/SearchItemView.ts +++ b/app/models/views/SearchItemView.ts @@ -1,6 +1,6 @@ export interface SearchItemView { /** 唯一标识符 **/ - id: number; + id: number | string; /** 条目类型 **/ type: 'product' | 'solution' | 'question' | 'document'; diff --git a/shared/types/meilisearch/meili-index.ts b/shared/types/meilisearch/meili-index.ts index 61f7b94..7b34473 100644 --- a/shared/types/meilisearch/meili-index.ts +++ b/shared/types/meilisearch/meili-index.ts @@ -73,6 +73,9 @@ export interface MeiliProductDocumentIndex { /** 相关产品类型 **/ product_types: string[]; + + /** 文件UUID **/ + fileUUID: string; } /** diff --git a/shared/types/meilisearch/search-result.ts b/shared/types/meilisearch/search-result.ts index a5da52d..03d88c0 100644 --- a/shared/types/meilisearch/search-result.ts +++ b/shared/types/meilisearch/search-result.ts @@ -1,4 +1,5 @@ import type { SearchResponse } from 'meilisearch'; +import type { MeiliSearchItemType } from './meili-index'; /** * 原始搜索分段结果 -- 2.49.0 From cea67404ed47b097cf98080813d70645ceb63ca7 Mon Sep 17 00:00:00 2001 From: R2m1liA <15258427350@163.com> Date: Thu, 30 Oct 2025 14:06:43 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E7=9B=B8=E5=85=B3=E9=97=AE=E9=A2=98=E8=B7=AF?= =?UTF-8?q?=E7=94=B1=E8=B7=B3=E8=BD=AC=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 当用户点击问题条目时,生成一个带有query的url: faq?focus=[slug]自动展开faq页面中的对应词条 --- app/components/pages/search/SearchResults.vue | 4 +++ app/components/shared/QuestionList.vue | 31 +++++++++++++++++-- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/app/components/pages/search/SearchResults.vue b/app/components/pages/search/SearchResults.vue index 5c01635..fd62149 100644 --- a/app/components/pages/search/SearchResults.vue +++ b/app/components/pages/search/SearchResults.vue @@ -128,6 +128,10 @@ return localePath({ path: `/download/${slug}` }); } + if (item.type === 'question') { + return localePath({ path: `/support/faq`, query: { focus: slug } }); + } + return null; }; diff --git a/app/components/shared/QuestionList.vue b/app/components/shared/QuestionList.vue index 58f8ef0..cb64b07 100644 --- a/app/components/shared/QuestionList.vue +++ b/app/components/shared/QuestionList.vue @@ -1,8 +1,9 @@