summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2017-12-23 04:21:15 +0900
committersyuilo <syuilotan@yahoo.co.jp>2017-12-23 04:21:15 +0900
commit8376b10b3b93d3c6cc50d69a6f0ae3ceb8c96c74 (patch)
tree11037986af1097c76a9c413bea5b8a082b8f86ef /src
parentUpdate search.ja.pug (diff)
downloadsharkey-8376b10b3b93d3c6cc50d69a6f0ae3ceb8c96c74.tar.gz
sharkey-8376b10b3b93d3c6cc50d69a6f0ae3ceb8c96c74.tar.bz2
sharkey-8376b10b3b93d3c6cc50d69a6f0ae3ceb8c96c74.zip
#1035
Diffstat (limited to 'src')
-rw-r--r--src/api/endpoints/posts/search.ts4
-rw-r--r--src/web/docs/search.ja.pug6
2 files changed, 9 insertions, 1 deletions
diff --git a/src/api/endpoints/posts/search.ts b/src/api/endpoints/posts/search.ts
index f722231d4c..4697e6ed0f 100644
--- a/src/api/endpoints/posts/search.ts
+++ b/src/api/endpoints/posts/search.ts
@@ -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))
}))
});
}
diff --git a/src/web/docs/search.ja.pug b/src/web/docs/search.ja.pug
index e94990205b..5baac9d400 100644
--- a/src/web/docs/search.ja.pug
+++ b/src/web/docs/search.ja.pug
@@ -6,6 +6,12 @@ p
| 例えば、「git コミット」と検索すると、「gitで編集したファイルの特定の行だけコミットする方法がわからない」などがマッチします。
section
+ h2 キーワードの除外
+ p キーワードの前に「-」(ハイフン)をプリフィクスすると、そのキーワードを含まない投稿に限定します。
+ p 例えば、「gitというキーワードを含むが、コミットというキーワードは含まない投稿」を検索したい場合、クエリは以下のようになります:
+ code git -コミット
+
+section
h2 オプション
p
| オプションを使用して、より高度な検索を行えます。