Renamed CacheManager to DocumentsRepository
This commit is contained in:
16
src/main.ts
16
src/main.ts
@@ -24,7 +24,7 @@ import {
|
||||
import { notifyOnIndexed, registerAPI } from './tools/api'
|
||||
import { Database } from './database'
|
||||
import { SearchEngine } from './search/search-engine'
|
||||
import { CacheManager } from './cache-manager'
|
||||
import { DocumentsRepository } from './repositories/documents-repository'
|
||||
import { logDebug } from './tools/utils'
|
||||
import { NotesIndexer } from './notes-indexer'
|
||||
import { TextProcessor } from './tools/text-processing'
|
||||
@@ -36,8 +36,8 @@ export default class OmnisearchPlugin extends Plugin {
|
||||
public apiHttpServer: null | any = null
|
||||
public settings: OmnisearchSettings = getDefaultSettings(this.app)
|
||||
|
||||
// FIXME: merge cache and cacheManager, or find other names
|
||||
public readonly cacheManager: CacheManager
|
||||
public readonly documentsRepository: DocumentsRepository
|
||||
public readonly embedsRepository = new EmbedsRepository(this)
|
||||
public readonly database = new Database(this)
|
||||
|
||||
public readonly notesIndexer = new NotesIndexer(this)
|
||||
@@ -45,14 +45,12 @@ export default class OmnisearchPlugin extends Plugin {
|
||||
public readonly searchEngine = new SearchEngine(this)
|
||||
public readonly searchHistory = new SearchHistory(this)
|
||||
|
||||
public readonly embedsRepository = new EmbedsRepository(this)
|
||||
|
||||
private ribbonButton?: HTMLElement
|
||||
private refreshIndexCallback?: () => void
|
||||
|
||||
constructor(app: App, manifest: PluginManifest) {
|
||||
super(app, manifest)
|
||||
this.cacheManager = new CacheManager(this)
|
||||
this.documentsRepository = new DocumentsRepository(this)
|
||||
}
|
||||
|
||||
async onload(): Promise<void> {
|
||||
@@ -121,7 +119,7 @@ export default class OmnisearchPlugin extends Plugin {
|
||||
this.registerEvent(
|
||||
this.app.vault.on('delete', file => {
|
||||
logDebug('Removing file', file.path)
|
||||
this.cacheManager.removeFromLiveCache(file.path)
|
||||
this.documentsRepository.removeDocument(file.path)
|
||||
searchEngine.removeFromPaths([file.path])
|
||||
this.embedsRepository.removeFile(file.path)
|
||||
})
|
||||
@@ -138,8 +136,8 @@ export default class OmnisearchPlugin extends Plugin {
|
||||
this.app.vault.on('rename', async (file, oldPath) => {
|
||||
if (this.notesIndexer.isFileIndexable(file.path)) {
|
||||
logDebug('Renaming file', file.path)
|
||||
this.cacheManager.removeFromLiveCache(oldPath)
|
||||
await this.cacheManager.addToLiveCache(file.path)
|
||||
this.documentsRepository.removeDocument(oldPath)
|
||||
await this.documentsRepository.addDocument(file.path)
|
||||
|
||||
searchEngine.removeFromPaths([oldPath])
|
||||
await searchEngine.addFromPaths([file.path])
|
||||
|
||||
Reference in New Issue
Block a user