mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
Merge branch 'master' into next53
# Conflicts: # package-lock.json # src/routes/api/search.js
This commit is contained in:
commit
0f7fa7a7b7
@ -36,7 +36,7 @@
|
|||||||
"commonmark": "0.30.0",
|
"commonmark": "0.30.0",
|
||||||
"cookie-parser": "1.4.6",
|
"cookie-parser": "1.4.6",
|
||||||
"csurf": "1.11.0",
|
"csurf": "1.11.0",
|
||||||
"dayjs": "1.11.2",
|
"dayjs": "1.11.3",
|
||||||
"ejs": "3.1.8",
|
"ejs": "3.1.8",
|
||||||
"electron-debug": "3.2.0",
|
"electron-debug": "3.2.0",
|
||||||
"electron-dl": "3.3.1",
|
"electron-dl": "3.3.1",
|
||||||
|
@ -1133,6 +1133,10 @@ class Note extends AbstractEntity {
|
|||||||
* @param {TaskContext} [taskContext]
|
* @param {TaskContext} [taskContext]
|
||||||
*/
|
*/
|
||||||
deleteNote(deleteId, taskContext) {
|
deleteNote(deleteId, taskContext) {
|
||||||
|
if (this.isDeleted) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!deleteId) {
|
if (!deleteId) {
|
||||||
deleteId = utils.randomString(10);
|
deleteId = utils.randomString(10);
|
||||||
}
|
}
|
||||||
|
@ -971,3 +971,8 @@ input {
|
|||||||
.note-split.full-content-width {
|
.note-split.full-content-width {
|
||||||
max-width: 999999px;
|
max-width: 999999px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
button.close:hover {
|
||||||
|
text-shadow: none;
|
||||||
|
color: currentColor;
|
||||||
|
}
|
||||||
|
@ -170,7 +170,6 @@ span.fancytree-active .fancytree-title {
|
|||||||
}
|
}
|
||||||
|
|
||||||
span.fancytree-selected {
|
span.fancytree-selected {
|
||||||
color: var(--hover-item-text-color) !important;
|
|
||||||
border-color: var(--main-border-color) !important;
|
border-color: var(--main-border-color) !important;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
}
|
}
|
||||||
|
@ -7,15 +7,16 @@ const scriptService = require('../../services/script');
|
|||||||
const searchService = require('../../services/search/services/search');
|
const searchService = require('../../services/search/services/search');
|
||||||
const bulkActionService = require("../../services/bulk_actions");
|
const bulkActionService = require("../../services/bulk_actions");
|
||||||
const {formatAttrForSearch} = require("../../services/attribute_formatter");
|
const {formatAttrForSearch} = require("../../services/attribute_formatter");
|
||||||
|
const utils = require("../../services/utils.js");
|
||||||
|
|
||||||
async function searchFromNoteInt(note) {
|
function searchFromNoteInt(note) {
|
||||||
let searchResultNoteIds;
|
let searchResultNoteIds;
|
||||||
|
|
||||||
const searchScript = note.getRelationValue('searchScript');
|
const searchScript = note.getRelationValue('searchScript');
|
||||||
const searchString = note.getLabelValue('searchString');
|
const searchString = note.getLabelValue('searchString');
|
||||||
|
|
||||||
if (searchScript) {
|
if (searchScript) {
|
||||||
searchResultNoteIds = await searchFromRelation(note, 'searchScript');
|
searchResultNoteIds = searchFromRelation(note, 'searchScript');
|
||||||
} else {
|
} else {
|
||||||
const searchContext = new SearchContext({
|
const searchContext = new SearchContext({
|
||||||
fastSearch: note.hasLabel('fastSearch'),
|
fastSearch: note.hasLabel('fastSearch'),
|
||||||
@ -57,7 +58,7 @@ async function searchFromNote(req) {
|
|||||||
return await searchFromNoteInt(note);
|
return await searchFromNoteInt(note);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function searchAndExecute(req) {
|
function searchAndExecute(req) {
|
||||||
const note = becca.getNote(req.params.noteId);
|
const note = becca.getNote(req.params.noteId);
|
||||||
|
|
||||||
if (!note) {
|
if (!note) {
|
||||||
@ -73,7 +74,7 @@ async function searchAndExecute(req) {
|
|||||||
return [400, `Note ${req.params.noteId} is not a search note.`]
|
return [400, `Note ${req.params.noteId} is not a search note.`]
|
||||||
}
|
}
|
||||||
|
|
||||||
const searchResultNoteIds = await searchFromNoteInt(note);
|
const searchResultNoteIds = searchFromNoteInt(note);
|
||||||
|
|
||||||
bulkActionService.executeActions(note, searchResultNoteIds);
|
bulkActionService.executeActions(note, searchResultNoteIds);
|
||||||
}
|
}
|
||||||
|
@ -78,6 +78,10 @@ function findResultsWithExpression(expression, searchContext) {
|
|||||||
|
|
||||||
const searchResults = noteSet.notes
|
const searchResults = noteSet.notes
|
||||||
.map(note => {
|
.map(note => {
|
||||||
|
if (note.isDeleted) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
const notePathArray = executionContext.noteIdToNotePath[note.noteId] || beccaService.getSomePath(note);
|
const notePathArray = executionContext.noteIdToNotePath[note.noteId] || beccaService.getSomePath(note);
|
||||||
|
|
||||||
if (!notePathArray) {
|
if (!notePathArray) {
|
||||||
@ -85,7 +89,8 @@ function findResultsWithExpression(expression, searchContext) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return new SearchResult(notePathArray);
|
return new SearchResult(notePathArray);
|
||||||
});
|
})
|
||||||
|
.filter(note => !!note);
|
||||||
|
|
||||||
for (const res of searchResults) {
|
for (const res of searchResults) {
|
||||||
res.computeScore(searchContext.highlightedTokens);
|
res.computeScore(searchContext.highlightedTokens);
|
||||||
@ -129,7 +134,7 @@ function parseQueryToExpression(query, searchContext) {
|
|||||||
structuredExpressionTokens,
|
structuredExpressionTokens,
|
||||||
expression
|
expression
|
||||||
};
|
};
|
||||||
|
|
||||||
log.info("Search debug: " + JSON.stringify(searchContext.debugInfo, null, 4));
|
log.info("Search debug: " + JSON.stringify(searchContext.debugInfo, null, 4));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -242,9 +242,9 @@ function transactional(func) {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
const entityChanges = cls.getAndClearEntityChangeIds();
|
const entityChangeIds = cls.getAndClearEntityChangeIds();
|
||||||
|
|
||||||
if (entityChanges.length > 0) {
|
if (entityChangeIds.length > 0) {
|
||||||
log.info("Transaction rollback dirtied the becca, forcing reload.");
|
log.info("Transaction rollback dirtied the becca, forcing reload.");
|
||||||
|
|
||||||
require('../becca/becca_loader').load();
|
require('../becca/becca_loader').load();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user