mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
search will also look for type and mime by default
This commit is contained in:
parent
058edcfe15
commit
b793f8cb88
@ -851,6 +851,10 @@ export default class NoteTreeWidget extends TabAwareWidget {
|
||||
|
||||
if (!foundChildNode) {
|
||||
if (logErrors) {
|
||||
// besides real errors this can be also caused by hiding of e.g. included images
|
||||
// these are real notes with real notePath, user can display them in a detail
|
||||
// but they don't have a node in the tree
|
||||
|
||||
ws.logError(`Can't find node for child node of noteId=${childNoteId} for parent of noteId=${parentNode.data.noteId} and hoistedNoteId=${hoistedNoteId}, requested path is ${notePath}`);
|
||||
}
|
||||
|
||||
|
@ -160,7 +160,7 @@ class Note {
|
||||
return this.flatTextCache;
|
||||
}
|
||||
|
||||
this.flatTextCache = this.noteId + ' ';
|
||||
this.flatTextCache = this.noteId + ' ' + this.type + ' ' + this.mime;
|
||||
|
||||
for (const branch of this.parentBranches) {
|
||||
if (branch.prefix) {
|
||||
|
@ -36,6 +36,12 @@ class NoteCacheFlatTextExp extends Expression {
|
||||
|
||||
const foundAttrTokens = [];
|
||||
|
||||
for (const token of tokens) {
|
||||
if (note.type.includes(token) || note.mime.includes(token)) {
|
||||
foundAttrTokens.push(token);
|
||||
}
|
||||
}
|
||||
|
||||
for (const attribute of note.ownedAttributes) {
|
||||
for (const token of tokens) {
|
||||
if (attribute.name.toLowerCase().includes(token)
|
||||
@ -77,10 +83,18 @@ class NoteCacheFlatTextExp extends Expression {
|
||||
|
||||
const foundAttrTokens = [];
|
||||
|
||||
for (const token of this.tokens) {
|
||||
if (note.type.includes(token) || note.mime.includes(token)) {
|
||||
foundAttrTokens.push(token);
|
||||
}
|
||||
}
|
||||
|
||||
for (const attribute of note.ownedAttributes) {
|
||||
const lcName = attribute.name.toLowerCase();
|
||||
const lcValue = attribute.value.toLowerCase();
|
||||
|
||||
for (const token of this.tokens) {
|
||||
if (attribute.name.toLowerCase().includes(token)
|
||||
|| attribute.value.toLowerCase().includes(token)) {
|
||||
if (lcName.includes(token) || lcValue.includes(token)) {
|
||||
foundAttrTokens.push(token);
|
||||
}
|
||||
}
|
||||
|
@ -146,6 +146,14 @@ function highlightSearchResults(searchResults, highlightedTokens) {
|
||||
|
||||
result.highlightedNotePathTitle = result.notePathTitle;
|
||||
|
||||
if (highlightedTokens.find(token => note.type.includes(token))) {
|
||||
result.highlightedNotePathTitle += ` <small>type: ${note.type}</small>`;
|
||||
}
|
||||
|
||||
if (highlightedTokens.find(token => note.mime.includes(token))) {
|
||||
result.highlightedNotePathTitle += ` <small>mime: ${note.mime}</small>`;
|
||||
}
|
||||
|
||||
for (const attr of note.attributes) {
|
||||
if (highlightedTokens.find(token => attr.name.includes(token) || attr.value.includes(token))) {
|
||||
result.highlightedNotePathTitle += ` <small>${formatAttribute(attr)}</small>`;
|
||||
|
Loading…
x
Reference in New Issue
Block a user