fix(#245): correctly update embeds on fs events
This commit is contained in:
@@ -112,7 +112,7 @@ export default class OmnisearchPlugin extends Plugin {
|
||||
if (this.notesIndexer.isFileIndexable(file.path)) {
|
||||
logDebug('Indexing new file', file.path)
|
||||
searchEngine.addFromPaths([file.path])
|
||||
this.embedsRepository.refreshEmbeds(file.path)
|
||||
this.embedsRepository.refreshEmbedsForNote(file.path)
|
||||
}
|
||||
})
|
||||
)
|
||||
@@ -121,7 +121,7 @@ export default class OmnisearchPlugin extends Plugin {
|
||||
logDebug('Removing file', file.path)
|
||||
this.cacheManager.removeFromLiveCache(file.path)
|
||||
searchEngine.removeFromPaths([file.path])
|
||||
this.embedsRepository.refreshEmbeds(file.path)
|
||||
this.embedsRepository.removeFile(file.path)
|
||||
})
|
||||
)
|
||||
this.registerEvent(
|
||||
@@ -129,7 +129,7 @@ export default class OmnisearchPlugin extends Plugin {
|
||||
if (this.notesIndexer.isFileIndexable(file.path)) {
|
||||
this.notesIndexer.flagNoteForReindex(file)
|
||||
}
|
||||
this.embedsRepository.refreshEmbeds(file.path)
|
||||
this.embedsRepository.refreshEmbedsForNote(file.path)
|
||||
})
|
||||
)
|
||||
this.registerEvent(
|
||||
@@ -138,8 +138,11 @@ export default class OmnisearchPlugin extends Plugin {
|
||||
logDebug('Renaming file', file.path)
|
||||
this.cacheManager.removeFromLiveCache(oldPath)
|
||||
await this.cacheManager.addToLiveCache(file.path)
|
||||
|
||||
searchEngine.removeFromPaths([oldPath])
|
||||
await searchEngine.addFromPaths([file.path])
|
||||
|
||||
this.embedsRepository.renameFile(oldPath, file.path)
|
||||
}
|
||||
})
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user