core&elastic: fix search by id

This commit is contained in:
undefined committed 2026-08-24 15:25:11 +08:00
1 parent e7a263c96d
commit f9fb8dcbf1
2 files changed
+2

No files matched your search

+1
View File
@@ -60,6 +60,7 @@ export default class ElasticSearchService extends Service {
pdoc = await ProblemModel.get(domainId, +q.substring(1), ProblemModel.PROJECTION_LIST);
if (pdoc) hits.unshift(`${pdoc.domainId}/${pdoc.docId}`);
}
if (hits.length > size) hits.pop();
}
return {
countRelation: typeof res.hits.total === 'number' ? 'eq' : res.hits.total.relation,
+1
View File
@@ -67,6 +67,7 @@ const defaultSearch = async (domainId: string, q: string, options?: ProblemSearc
pdoc = await problem.get(domainId, +q.substring(1), projection);
if (pdoc) pdocs.unshift(pdoc);
}
if (pdocs.length > (options.limit || system.get('pagination.problem'))) pdocs.pop();
}
return {
hits: Array.from(new Set(pdocs.map((i) => `${i.domainId}/${i.docId}`))),