From 7ab482184bc4d1dea9cfbd79e03f36c562c7b752 Mon Sep 17 00:00:00 2001 From: asmsuechan Date: Fri, 13 Oct 2017 11:40:10 +0900 Subject: [PATCH] Improve tag search by changing the logic --- browser/lib/search.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/browser/lib/search.js b/browser/lib/search.js index 65ec33a9..d102e381 100644 --- a/browser/lib/search.js +++ b/browser/lib/search.js @@ -3,9 +3,10 @@ import _ from 'lodash' export default function searchFromNotes (notes, search) { if (search.trim().length === 0) return [] const searchBlocks = search.split(' ').filter(block => { return block !== '' }) - let foundNotes = [] + + let foundNotes = findByWord(notes, searchBlocks[0]) searchBlocks.forEach((block) => { - foundNotes = findByWord(notes, block) + foundNotes = findByWord(foundNotes, block) if (block.match(/^#.+/)) { foundNotes = foundNotes.concat(findByTag(notes, block)) }