Commit 0c0e54cb by dingzhenznen Committed by GitHub

fix:collection search (#5217)

parent a506f661
...@@ -15,6 +15,7 @@ import { parsePaginationRequest } from '@fastgpt/service/common/api/pagination'; ...@@ -15,6 +15,7 @@ import { parsePaginationRequest } from '@fastgpt/service/common/api/pagination';
import { type DatasetCollectionSchemaType } from '@fastgpt/global/core/dataset/type'; import { type DatasetCollectionSchemaType } from '@fastgpt/global/core/dataset/type';
import { MongoDatasetData } from '@fastgpt/service/core/dataset/data/schema'; import { MongoDatasetData } from '@fastgpt/service/core/dataset/data/schema';
import { MongoDatasetTraining } from '@fastgpt/service/core/dataset/training/schema'; import { MongoDatasetTraining } from '@fastgpt/service/core/dataset/training/schema';
import { replaceRegChars } from '@fastgpt/global/common/string/tools';
async function handler( async function handler(
req: NextApiRequest req: NextApiRequest
...@@ -46,7 +47,7 @@ async function handler( ...@@ -46,7 +47,7 @@ async function handler(
...(selectFolder ? { type: DatasetCollectionTypeEnum.folder } : {}), ...(selectFolder ? { type: DatasetCollectionTypeEnum.folder } : {}),
...(searchText ...(searchText
? { ? {
name: new RegExp(searchText, 'i') name: new RegExp(`${replaceRegChars(searchText)}`, 'i')
} }
: { : {
parentId: parentId ? new Types.ObjectId(parentId) : null parentId: parentId ? new Types.ObjectId(parentId) : null
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment