This commit is contained in:
syuilo 2017-12-23 04:21:15 +09:00
parent 52ea44394a
commit 8376b10b3b
2 changed files with 9 additions and 1 deletions

View File

@ -99,7 +99,9 @@ async function byNative(res, rej, me, text, userId, following, mute, reply, repo
if (text) {
push({
$and: text.split(' ').map(x => ({
text: new RegExp(escapeRegexp(x))
text: x[0] == '-' ? {
$ne: new RegExp(escapeRegexp(x))
} : new RegExp(escapeRegexp(x))
}))
});
}

View File

@ -5,6 +5,12 @@ p
| キーワードを半角スペースで区切ると、and検索になります。
| 例えば、「git コミット」と検索すると、「gitで編集したファイルの特定の行だけコミットする方法がわからない」などがマッチします。
section
h2 キーワードの除外
p キーワードの前に「-」(ハイフン)をプリフィクスすると、そのキーワードを含まない投稿に限定します。
p 例えば、「gitというキーワードを含むが、コミットというキーワードは含まない投稿」を検索したい場合、クエリは以下のようになります:
code git -コミット
section
h2 オプション
p