mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
core&elastic: fix search by id
This commit is contained in:
2 files changed
+2
No files matched your search
@@ -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,
|
||||
|
||||
@@ -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}`))),
|
||||
|
||||
Reference in new issue
Block a user