diff --git a/packages/sonic/model.ts b/packages/sonic/model.ts index a8b60ef8..a3c8f9e4 100644 --- a/packages/sonic/model.ts +++ b/packages/sonic/model.ts @@ -8,7 +8,7 @@ bus.on('problem/add', async (doc, docId) => { const tasks = []; for (const domainId of [doc.domainId, ...union.map((i) => i._id)]) { tasks.push( - sonic.push('problem', `${domainId}@title`, `${doc.domainId}/${docId}`, doc.title), + sonic.push('problem', `${domainId}@title`, `${doc.domainId}/${docId}`, `${doc.pid || ''} ${doc.title}`), sonic.push('problem', `${domainId}@content`, `${doc.domainId}/${docId}`, doc.content.toString()), ); } @@ -22,7 +22,7 @@ bus.on('problem/edit', async (pdoc) => { for (const domainId of [pdoc.domainId, ...union.map((i) => i._id)]) { tasks.push( sonic.flusho('problem', `${domainId}@title`, id) - .then(() => sonic.push('problem', `${domainId}@title`, id, pdoc.title)), + .then(() => sonic.push('problem', `${domainId}@title`, id, `${pdoc.pid || ''} ${pdoc.title}`)), sonic.flusho('problem', `${domainId}@content`, id) .then(() => sonic.push('problem', `${domainId}@content`, id, pdoc.content.toString())), ); diff --git a/packages/sonic/package.json b/packages/sonic/package.json index 5765f648..d8d5b0b0 100644 --- a/packages/sonic/package.json +++ b/packages/sonic/package.json @@ -1,6 +1,6 @@ { "name": "@hydrooj/sonic", - "version": "1.2.1", + "version": "1.2.2", "description": "Sonic search service", "main": "service.js", "typings": "service.d.ts", diff --git a/packages/sonic/script.ts b/packages/sonic/script.ts index 57e69baf..8c139ddd 100644 --- a/packages/sonic/script.ts +++ b/packages/sonic/script.ts @@ -15,7 +15,7 @@ export async function run({ domainId }, report) { const tasks = []; for (const did of [pdoc.domainId, ...union.map((j) => j._id)]) { tasks.push( - pdoc.title && sonic.push('problem', `${did}@title`, `${pdoc.domainId}/${pdoc.docId}`, pdoc.title), + pdoc.title && sonic.push('problem', `${did}@title`, `${pdoc.domainId}/${pdoc.docId}`, `${pdoc.pid || ''} ${pdoc.title}`), pdoc.content.toString() && sonic.push('problem', `${did}@content`, `${pdoc.domainId}/${pdoc.docId}`, pdoc.content.toString()), ); }