mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
sonic: search by problem tag
This commit is contained in:
1 parent
d60f31c427
commit
46179ab3e5
3 files changed
+7
-4
No files matched your search
@@ -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.pid || ''} ${doc.title}`),
|
||||
sonic.push('problem', `${domainId}@title`, `${doc.domainId}/${docId}`, `${doc.pid || ''} ${doc.title} ${doc.tag?.join(' ')}`),
|
||||
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.pid || ''} ${pdoc.title}`)),
|
||||
.then(() => sonic.push('problem', `${domainId}@title`, id, `${pdoc.pid || ''} ${pdoc.title} ${pdoc.tag?.join(' ')}`)),
|
||||
sonic.flusho('problem', `${domainId}@content`, id)
|
||||
.then(() => sonic.push('problem', `${domainId}@content`, id, pdoc.content.toString())),
|
||||
);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hydrooj/sonic",
|
||||
"version": "1.2.2",
|
||||
"version": "1.2.3",
|
||||
"description": "Sonic search service",
|
||||
"main": "service.js",
|
||||
"typings": "service.d.ts",
|
||||
|
||||
@@ -15,7 +15,10 @@ 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.pid || ''} ${pdoc.title}`),
|
||||
pdoc.title && sonic.push(
|
||||
'problem', `${did}@title`, `${pdoc.domainId}/${pdoc.docId}`,
|
||||
`${pdoc.pid || ''} ${pdoc.title} ${pdoc.tag.join(' ')}`,
|
||||
),
|
||||
pdoc.content.toString() && sonic.push('problem', `${did}@content`, `${pdoc.domainId}/${pdoc.docId}`, pdoc.content.toString()),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user