1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-05 07:45:54 +02:00
This commit is contained in:
syuilo
2017-12-23 04:38:56 +09:00
parent 020ce794af
commit 7cf4aa9f11
2 changed files with 21 additions and 8 deletions

View File

@@ -97,14 +97,22 @@ async function byNative(res, rej, me, text, userId, following, mute, reply, repo
const push = x => q.$and.push(x);
if (text) {
push({
$and: text.split(' ').map(x => ({
// キーワードが-で始まる場合そのキーワードを除外する
text: x[0] == '-' ? {
$not: new RegExp(escapeRegexp(x.substr(1)))
} : new RegExp(escapeRegexp(x))
}))
});
// 完全一致検索
if (/"""(.+?)"""/.test(text)) {
const x = text.match(/"""(.+?)"""/)[1];
push({
text: x
});
} else {
push({
$and: text.split(' ').map(x => ({
// キーワードが-で始まる場合そのキーワードを除外する
text: x[0] == '-' ? {
$not: new RegExp(escapeRegexp(x.substr(1)))
} : new RegExp(escapeRegexp(x))
}))
});
}
}
if (userId) {