From 9292df217caae4c4f6d33be3aeb0805a003c7511 Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 26 Feb 2018 01:06:21 +0900 Subject: [PATCH] :v: --- src/api/endpoints/posts/search.ts | 9 +++++++++ src/web/app/desktop/views/components/post-detail.vue | 2 +- src/web/app/desktop/views/components/posts.post.vue | 2 +- src/web/app/mobile/views/components/post-detail.vue | 2 +- src/web/app/mobile/views/components/posts.post.vue | 2 +- src/web/docs/search.ja.pug | 4 ++++ 6 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/api/endpoints/posts/search.ts b/src/api/endpoints/posts/search.ts index 6e26f55390..a36d1178a5 100644 --- a/src/api/endpoints/posts/search.ts +++ b/src/api/endpoints/posts/search.ts @@ -121,6 +121,15 @@ async function search( text: x }); } else { + const tags = text.split(' ').filter(x => x[0] == '#'); + if (tags) { + push({ + $and: tags.map(x => ({ + tags: x + })) + }); + } + push({ $and: text.split(' ').map(x => ({ // キーワードが-で始まる場合そのキーワードを除外する diff --git a/src/web/app/desktop/views/components/post-detail.vue b/src/web/app/desktop/views/components/post-detail.vue index 1e31752fe7..e6e0ffa021 100644 --- a/src/web/app/desktop/views/components/post-detail.vue +++ b/src/web/app/desktop/views/components/post-detail.vue @@ -45,7 +45,7 @@
- {{ tag }} + {{ tag }}