Skip to content

TagSpaces is an offline, open source, document manager with tagging support

feat: adding the file uuid in the searched fields

Ilian Sapundshiev8ea51dec2ec7
diff --git a/src/renderer/services/search.ts b/src/renderer/services/search.ts
index 65eea9a5c..fd2875732 100644
--- a/src/renderer/services/search.ts
+++ b/src/renderer/services/search.ts
@@ -159,7 +159,7 @@ const fuseOptions = {
keys: [
{
name: 'name',
- weight: 0.3,
+ weight: 0.2,
},
{
name: 'description',
@@ -177,6 +177,10 @@ const fuseOptions = {
name: 'path', // TODO ignore .ts folder, should not be in the index
weight: 0.1,
},
+ {
+ name: 'uuid',
+ weight: 0.1,
+ },
],
};
@@ -410,15 +414,18 @@ export default class Search {
ignoreCase && entry.textContent
? entry.textContent.toLowerCase()
: entry.textContent;
+ const uuid =
+ ignoreCase && entry.uuid ? entry.uuid.toLowerCase() : entry.uuid;
const path = ignoreCase
? entry.path && entry.path.toLowerCase()
: entry.path;
// const foundInName = name && name.includes(textQuery);
const foundInDescr = description && description.includes(textQuery);
+ const foundInUuid = uuid && uuid.includes(textQuery);
const foundInContent =
textContent && textContent.includes(textQuery);
const foundInPath = path && path.includes(textQuery);
- return foundInPath || foundInDescr || foundInContent; // || foundInName;
+ return foundInPath || foundInDescr || foundInContent || foundInUuid; // || foundInName;
});
} else {
const fuse = new Fuse(results, fuseOptions);