mirror of
https://github.com/TriliumNext/Notes.git
synced 2026-01-30 17:18:35 -06:00
fixed saved search
This commit is contained in:
@@ -6,15 +6,11 @@ const $searchString = $("#search-string");
|
||||
const $component = $('#note-detail-search');
|
||||
const $refreshButton = $('#note-detail-search-refresh-results-button');
|
||||
|
||||
function getContent() {
|
||||
return JSON.stringify({
|
||||
searchString: $searchString.val()
|
||||
});
|
||||
}
|
||||
|
||||
function show() {
|
||||
$component.show();
|
||||
|
||||
console.log(noteDetailService.getCurrentNote());
|
||||
|
||||
try {
|
||||
const json = JSON.parse(noteDetailService.getCurrentNote().noteContent.content);
|
||||
|
||||
@@ -28,6 +24,12 @@ function show() {
|
||||
$searchString.on('input', noteDetailService.noteChanged);
|
||||
}
|
||||
|
||||
function getContent() {
|
||||
return JSON.stringify({
|
||||
searchString: $searchString.val()
|
||||
});
|
||||
}
|
||||
|
||||
$refreshButton.click(async () => {
|
||||
await noteDetailService.saveNoteIfChanged();
|
||||
|
||||
|
||||
@@ -126,7 +126,9 @@ async function prepareRealBranch(parentNote) {
|
||||
|
||||
async function prepareSearchBranch(note) {
|
||||
const fullNote = await noteDetailService.loadNote(note.noteId);
|
||||
const results = (await server.get('search/' + encodeURIComponent(fullNote.jsonContent.searchString)))
|
||||
const json = JSON.parse(fullNote.noteContent.content);
|
||||
|
||||
const results = (await server.get('search/' + encodeURIComponent(json.searchString)))
|
||||
.filter(res => res.noteId !== note.noteId); // this is necessary because title of the search note is often the same as the search text which would match and create circle
|
||||
|
||||
// force to load all the notes at once instead of one by one
|
||||
|
||||
Reference in New Issue
Block a user