Slight indexing perf improvement
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Notice } from 'obsidian'
|
||||
import { Notice, TFile } from 'obsidian'
|
||||
import {
|
||||
type DocumentRef,
|
||||
getTextExtractor,
|
||||
@@ -32,8 +32,9 @@ import { settings } from './settings'
|
||||
async function getAndMapIndexedDocument(
|
||||
path: string
|
||||
): Promise<IndexedDocument> {
|
||||
const file = app.vault.getFiles().find(f => f.path === path)
|
||||
const file = app.vault.getAbstractFileByPath(path)
|
||||
if (!file) throw new Error(`Invalid file path: "${path}"`)
|
||||
if (!(file instanceof TFile)) throw new Error(`Not a TFile: "${path}"`)
|
||||
let content: string | null = null
|
||||
|
||||
const extractor = getTextExtractor()
|
||||
|
||||
Reference in New Issue
Block a user