Group {{query:...}} results by page
This commit is contained in:
parent
dec8e85064
commit
707f84ec43
|
@ -157,22 +157,24 @@ function showSearchResultsExtended(element, template, searchTool, query, input,
|
|||
})
|
||||
}
|
||||
|
||||
function formatLineResult(hit) {
|
||||
function formatLineResult(hits, key) {
|
||||
return [
|
||||
{
|
||||
text: "[[" + hit.title + "]]",
|
||||
text: "[[" + key + "]]",
|
||||
indented: 0,
|
||||
fold: 'open',
|
||||
hidden: false,
|
||||
fleeting: true
|
||||
},
|
||||
{
|
||||
text: hit.line,
|
||||
indented: 1,
|
||||
fold: 'open',
|
||||
hidden: false,
|
||||
fleeting: true
|
||||
}
|
||||
..._.map(hits, (hit) => {
|
||||
return {
|
||||
text: hit.line,
|
||||
indented: 1,
|
||||
fold: 'open',
|
||||
hidden: false,
|
||||
fleeting: true
|
||||
}
|
||||
})
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -629,6 +631,7 @@ function Editor(holder, input) {
|
|||
.finally(() => editor.render())
|
||||
} else {
|
||||
return search.startQuery(res[2])
|
||||
.then(hits => _.groupBy(hits, (it) => it.title))
|
||||
.then(hits => _.flatMap(hits, formatLineResult))
|
||||
.then(results => editor.replaceChildren(id, results))
|
||||
.finally(() => editor.render())
|
||||
|
|
Loading…
Reference in New Issue
Block a user