Squashed commit of the following:
commit 3b229cad538ad88ef2d366964c4261bc0e02fb7c Author: Simon Cambier <simon.cambier@protonmail.com> Date: Sat Nov 5 14:30:08 2022 +0100 1.8.0-beta.1 commit f43c369b2dd0a1083b171724e3f7466429505629 Author: Simon Cambier <simon.cambier@protonmail.com> Date: Sat Nov 5 13:39:45 2022 +0100 Squashed commit of the following: commit 93508ee95046385baf62475e5bd835ed9fafe6d3 Author: Simon Cambier <simon.cambier@protonmail.com> Date: Sat Nov 5 13:35:56 2022 +0100 Cleaning commit 205e6a7cce4c1939338820f366f7ae8a067ec7fb Author: Simon Cambier <simon.cambier@protonmail.com> Date: Fri Nov 4 08:53:46 2022 +0100 Added logs commit ea19b94e164581829908ac71d09a60e230925a7f Author: Simon Cambier <simon.cambier@protonmail.com> Date: Thu Nov 3 22:27:24 2022 +0100 Notices commit 53ff4e822b3c292a56da150b94a1cfe43e199d44 Author: Simon Cambier <simon.cambier@protonmail.com> Date: Thu Nov 3 22:27:09 2022 +0100 Custom minisearch build + Notice when the cache could be corrupted commit 498408afd1c350dd68969318c3533fff8aa6c172 Author: Simon Cambier <simon.cambier@protonmail.com> Date: Thu Nov 3 22:26:22 2022 +0100 Added a button to manually clear the cache commit 90afe5d3868989626ba4613b064e24ac7efa88be Author: Simon Cambier <simon.cambier@protonmail.com> Date: Thu Nov 3 22:03:41 2022 +0100 Optimized loading minisearch from cache commit 719dcb9c82f09f56dabb828ac13c9c1db7f795bb Author: Simon Cambier <simon.cambier@protonmail.com> Date: Thu Nov 3 21:43:49 2022 +0100 #92 - Refactored cache to make it behave like pre-indexedDb commit 2164ccfa39d83eef23231d01e8aa35ac30e0d31c Author: Simon Cambier <simon.cambier@protonmail.com> Date: Wed Nov 2 23:13:59 2022 +0100 Removed cache & tmp engine commit 50eb33bbd4d074be9a9952eaf871cd8f58b327e6 Author: Simon Cambier <simon.cambier@protonmail.com> Date: Wed Nov 2 22:56:04 2022 +0100 More efficient loading of PDFs commita6342a675fAuthor: Simon Cambier <simon.cambier@protonmail.com> Date: Wed Nov 2 10:34:02 2022 +0100 #120 - Cleaning of old cache databases commitb6890567f3Author: Simon Cambier <simon.cambier@protonmail.com> Date: Mon Oct 31 17:28:17 2022 +0100 Updated Readme
This commit is contained in:
@@ -27,19 +27,19 @@ export async function addToIndexAndMemCache(
|
||||
|
||||
// Check if the file was already indexed as non-existent.
|
||||
// If so, remove it from the index, and add it again as a real note.
|
||||
if (cacheManager.getDocument(file.path)?.doesNotExist) {
|
||||
if (cacheManager.getLiveDocument(file.path)?.doesNotExist) {
|
||||
removeFromIndex(file.path)
|
||||
}
|
||||
|
||||
try {
|
||||
if (cacheManager.getDocument(file.path)) {
|
||||
if (cacheManager.getLiveDocument(file.path)) {
|
||||
throw new Error(`${file.basename} is already indexed`)
|
||||
}
|
||||
|
||||
// Make the document and index it
|
||||
const note = await fileToIndexedDocument(file)
|
||||
SearchEngine.getEngine().addSingleToMinisearch(note)
|
||||
await cacheManager.updateDocument(note.path, note)
|
||||
await cacheManager.updateLiveDocument(note.path, note)
|
||||
} catch (e) {
|
||||
// console.trace('Error while indexing ' + file.basename)
|
||||
console.error(e)
|
||||
@@ -55,7 +55,7 @@ export async function addToIndexAndMemCache(
|
||||
export function addNonExistingToIndex(name: string, parent: string): void {
|
||||
name = removeAnchors(name)
|
||||
const filename = name + (name.endsWith('.md') ? '' : '.md')
|
||||
if (cacheManager.getDocument(filename)) return
|
||||
if (cacheManager.getLiveDocument(filename)) return
|
||||
|
||||
const note: IndexedDocument = {
|
||||
path: filename,
|
||||
@@ -73,7 +73,7 @@ export function addNonExistingToIndex(name: string, parent: string): void {
|
||||
parent,
|
||||
}
|
||||
SearchEngine.getEngine().addSingleToMinisearch(note)
|
||||
cacheManager.updateDocument(filename, note)
|
||||
cacheManager.updateLiveDocument(filename, note)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -84,10 +84,10 @@ export function removeFromIndex(path: string): void {
|
||||
console.info(`"${path}" is not an indexable file`)
|
||||
return
|
||||
}
|
||||
const note = cacheManager.getDocument(path)
|
||||
const note = cacheManager.getLiveDocument(path)
|
||||
if (note) {
|
||||
SearchEngine.getEngine().removeFromMinisearch(note)
|
||||
cacheManager.deleteDocument(path)
|
||||
cacheManager.deleteLiveDocument(path)
|
||||
|
||||
// FIXME: only remove non-existing notes if they don't have another parent
|
||||
// cacheManager
|
||||
|
||||
Reference in New Issue
Block a user