Add storeIndexInFile setting

This commit is contained in:
Michael Naumov
2022-06-06 08:12:51 -06:00
parent 7cd4f6c502
commit 9b1123dee8
3 changed files with 34 additions and 11 deletions

View File

@@ -6,6 +6,7 @@ import {
} from 'obsidian'
import type { IndexedNote, ResultNote } from './globals'
import { stringsToRegex } from './utils'
import { settings } from './settings'
/**
* This is an in-memory cache of the notes, with all their computed fields
@@ -21,7 +22,7 @@ export function resetNotesCache(): void {
}
export async function loadNotesCache(): Promise<void> {
if (await app.vault.adapter.exists(notesCacheFilePath)) {
if (settings.storeIndexInFile && await app.vault.adapter.exists(notesCacheFilePath)) {
try {
const json = await app.vault.adapter.read(notesCacheFilePath)
notesCache = JSON.parse(json)