From 9f81288fccdbaf9184d49e61680747945b34f23d Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 17 Jan 2017 11:11:22 +0900 Subject: Fix bug --- src/api/endpoints/posts/search.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/api/endpoints/posts/search.js') diff --git a/src/api/endpoints/posts/search.js b/src/api/endpoints/posts/search.js index 0f214ef7ae..239517b993 100644 --- a/src/api/endpoints/posts/search.js +++ b/src/api/endpoints/posts/search.js @@ -65,8 +65,7 @@ async function byNative(res, rej, me, query, offset, max) { }, limit: max, skip: offset - }) - .toArray(); + }); // Serialize res(await Promise.all(posts.map(async post => @@ -120,12 +119,11 @@ async function byElasticsearch(res, rej, me, query, offset, max) { _id: { $in: hits } - }, {}, { + }, { sort: { _id: -1 } - }) - .toArray(); + }); posts.map(post => { post._highlight = response.hits.hits.filter(hit => post._id.equals(hit._id))[0].highlight.text[0]; -- cgit v1.3.1-freya