mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
don't show hidden subtree in autocomplete, fixes #2301
This commit is contained in:
parent
7400a6723e
commit
51348cfbad
@ -159,16 +159,6 @@ function findResultsWithQuery(query, searchContext) {
|
|||||||
return findResultsWithExpression(expression, searchContext);
|
return findResultsWithExpression(expression, searchContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
function searchTrimmedNotes(query, searchContext) {
|
|
||||||
const allSearchResults = findResultsWithQuery(query, searchContext);
|
|
||||||
const trimmedSearchResults = allSearchResults.slice(0, 200);
|
|
||||||
|
|
||||||
return {
|
|
||||||
count: allSearchResults.length,
|
|
||||||
results: trimmedSearchResults
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function searchNotesForAutocomplete(query) {
|
function searchNotesForAutocomplete(query) {
|
||||||
const searchContext = new SearchContext({
|
const searchContext = new SearchContext({
|
||||||
fastSearch: true,
|
fastSearch: true,
|
||||||
@ -176,11 +166,14 @@ function searchNotesForAutocomplete(query) {
|
|||||||
fuzzyAttributeSearch: true
|
fuzzyAttributeSearch: true
|
||||||
});
|
});
|
||||||
|
|
||||||
const {results} = searchTrimmedNotes(query, searchContext);
|
const allSearchResults = findResultsWithQuery(query, searchContext)
|
||||||
|
.filter(res => !res.notePathArray.includes("hidden"));
|
||||||
|
|
||||||
highlightSearchResults(results, searchContext.highlightedTokens);
|
const trimmed = allSearchResults.slice(0, 200);
|
||||||
|
|
||||||
return results.map(result => {
|
highlightSearchResults(trimmed, searchContext.highlightedTokens);
|
||||||
|
|
||||||
|
return trimmed.map(result => {
|
||||||
return {
|
return {
|
||||||
notePath: result.notePath,
|
notePath: result.notePath,
|
||||||
noteTitle: beccaService.getNoteTitle(result.noteId),
|
noteTitle: beccaService.getNoteTitle(result.noteId),
|
||||||
@ -260,7 +253,6 @@ function formatAttribute(attr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
searchTrimmedNotes,
|
|
||||||
searchNotesForAutocomplete,
|
searchNotesForAutocomplete,
|
||||||
findResultsWithQuery,
|
findResultsWithQuery,
|
||||||
searchNotes
|
searchNotes
|
||||||
|
Loading…
x
Reference in New Issue
Block a user