mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 17:56:25 +00:00
Improve tag search by changing the logic
This commit is contained in:
@@ -3,9 +3,10 @@ import _ from 'lodash'
|
|||||||
export default function searchFromNotes (notes, search) {
|
export default function searchFromNotes (notes, search) {
|
||||||
if (search.trim().length === 0) return []
|
if (search.trim().length === 0) return []
|
||||||
const searchBlocks = search.split(' ').filter(block => { return block !== '' })
|
const searchBlocks = search.split(' ').filter(block => { return block !== '' })
|
||||||
let foundNotes = []
|
|
||||||
|
let foundNotes = findByWord(notes, searchBlocks[0])
|
||||||
searchBlocks.forEach((block) => {
|
searchBlocks.forEach((block) => {
|
||||||
foundNotes = findByWord(notes, block)
|
foundNotes = findByWord(foundNotes, block)
|
||||||
if (block.match(/^#.+/)) {
|
if (block.match(/^#.+/)) {
|
||||||
foundNotes = foundNotes.concat(findByTag(notes, block))
|
foundNotes = foundNotes.concat(findByTag(notes, block))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user