core: use case-sensitive query

This commit is contained in:
undefined committed 2022-12-10 04:27:25 +08:00
1 parent 076e2097c0
commit c5ad6599a8
3 files changed
+3 -5

No files matched your search

+1 -2
View File
@@ -330,8 +330,7 @@ export class ProblemModel {
}
static async getPrefixList(domainId: string, prefix: string) {
prefix = prefix.toLowerCase();
const $regex = new RegExp(`\\A${escapeRegExp(prefix)}`, 'gmi');
const $regex = new RegExp(`^${escapeRegExp(prefix.toLowerCase())}`, 'i');
const filter = { $or: [{ pid: { $regex } }, { title: { $regex } }] };
return await document.getMulti(domainId, document.TYPE_PROBLEM, filter, ['domainId', 'docId', 'pid', 'title'])
.limit(20).toArray();