From 9292df217caae4c4f6d33be3aeb0805a003c7511 Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 26 Feb 2018 01:06:21 +0900 Subject: :v: --- src/api/endpoints/posts/search.ts | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/api/endpoints/posts/search.ts') 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 => ({ // キーワードが-で始まる場合そのキーワードを除外する -- cgit v1.2.3-freya