mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
quick search shows search errors #3221
This commit is contained in:
parent
b202b43bf5
commit
ecaa9a1d56
@ -98,9 +98,21 @@ export default class QuickSearchWidget extends BasicWidget {
|
||||
this.$dropdownMenu.empty();
|
||||
this.$dropdownMenu.append('<span class="dropdown-item disabled"><span class="bx bx-loader bx-spin"></span> Searching ...</span>');
|
||||
|
||||
const resultNoteIds = await server.get('quick-search/' + encodeURIComponent(searchString));
|
||||
const {searchResultNoteIds, error} = await server.get('quick-search/' + encodeURIComponent(searchString));
|
||||
|
||||
const displayedNoteIds = resultNoteIds.slice(0, Math.min(MAX_DISPLAYED_NOTES, resultNoteIds.length));
|
||||
if (error) {
|
||||
this.$searchString.tooltip({
|
||||
trigger: 'manual',
|
||||
title: "Search error: " + error,
|
||||
placement: 'right'
|
||||
});
|
||||
|
||||
this.$searchString.tooltip("show");
|
||||
|
||||
setTimeout(() => this.$searchString.tooltip("dispose"), 4000);
|
||||
}
|
||||
|
||||
const displayedNoteIds = searchResultNoteIds.slice(0, Math.min(MAX_DISPLAYED_NOTES, searchResultNoteIds.length));
|
||||
|
||||
this.$dropdownMenu.empty();
|
||||
|
||||
@ -129,8 +141,8 @@ export default class QuickSearchWidget extends BasicWidget {
|
||||
this.$dropdownMenu.append($link);
|
||||
}
|
||||
|
||||
if (resultNoteIds.length > MAX_DISPLAYED_NOTES) {
|
||||
this.$dropdownMenu.append(`<span class="dropdown-item disabled">... and ${resultNoteIds.length - MAX_DISPLAYED_NOTES} more results.</span>`);
|
||||
if (searchResultNoteIds.length > MAX_DISPLAYED_NOTES) {
|
||||
this.$dropdownMenu.append(`<span class="dropdown-item disabled">... and ${searchResultNoteIds.length - MAX_DISPLAYED_NOTES} more results.</span>`);
|
||||
}
|
||||
|
||||
const $showInFullButton = $('<a class="dropdown-item" tabindex="0">')
|
||||
|
@ -385,7 +385,11 @@ table.promoted-attributes-in-tooltip td, table.promoted-attributes-in-tooltip th
|
||||
font-size: var(--main-font-size) !important;
|
||||
}
|
||||
|
||||
.tooltip .arrow {
|
||||
.tooltip .arrow::before {
|
||||
border-right-color: var(--main-border-color) !important;
|
||||
}
|
||||
|
||||
.note-tooltip.tooltip .arrow {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
@ -58,8 +58,13 @@ function quickSearch(req) {
|
||||
fuzzyAttributeSearch: false
|
||||
});
|
||||
|
||||
return searchService.findResultsWithQuery(searchString, searchContext)
|
||||
const resultNoteIds = searchService.findResultsWithQuery(searchString, searchContext)
|
||||
.map(sr => sr.noteId);
|
||||
|
||||
return {
|
||||
searchResultNoteIds: resultNoteIds,
|
||||
error: searchContext.getError()
|
||||
};
|
||||
}
|
||||
|
||||
function search(req) {
|
||||
|
@ -76,7 +76,7 @@ function lex(str) {
|
||||
quotes = false;
|
||||
}
|
||||
else {
|
||||
// it's a quote but within other kind of quotes so it's valid as a literal character
|
||||
// it's a quote but within other kind of quotes, so it's valid as a literal character
|
||||
currentWord += chr;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user