From f9aa721ddd21470ceba367e7419a4a9323b42e4d Mon Sep 17 00:00:00 2001 From: pqcqaq <905739777@qq.com> Date: Thu, 17 Oct 2024 23:38:41 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=BA=86=E7=B4=A2=E5=BC=95?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=EF=BC=8C=E5=AF=B9=E6=96=87=E7=AB=A0=E5=85=A8?= =?UTF-8?q?=E6=96=87=E8=BF=9B=E8=A1=8C=E6=A3=80=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/entities/Essay.ts | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/entities/Essay.ts b/src/entities/Essay.ts index e9f65d5..3580c95 100644 --- a/src/entities/Essay.ts +++ b/src/entities/Essay.ts @@ -91,13 +91,27 @@ export const entityDesc: EntityDesc< attributes: [ { name: 'title', + size: 32, }, ], config: { unique: true, - // 索引类型,方便根据标题查找文章 - type: 'fulltext', + // 标题使用btree索引进行前缀搜索 + type: 'btree', }, }, + // 根据文章内容搜索的全文检索索引 + { + name: 'content_fulltext', + attributes: [ + { + name: 'content', + }, + ], + config: { + type: 'fulltext', + parser: 'ngram', + }, + } ], };