WIP refactor to take advantage of minisearch 6.0

This commit is contained in:
Simon Cambier
2022-11-25 08:28:50 +01:00
parent 2daa718bc9
commit dcef2d3719
10 changed files with 172 additions and 97 deletions

View File

@@ -1,9 +1,9 @@
import {
type CachedMetadata,
Notice,
Platform,
getAllTags,
Notice,
parseFrontMatterAliases,
Platform,
} from 'obsidian'
import type { SearchMatch } from '../globals'
import {
@@ -207,8 +207,8 @@ export function getCtrlKeyLabel(): 'ctrl' | '⌘' {
export function isFileIndexable(path: string): boolean {
return (
(settings.PDFIndexing && path.endsWith('.pdf')) ||
isFilePlaintext(path) ||
(settings.PDFIndexing && isFilePDF(path)) ||
(settings.imagesIndexing && isFileImage(path))
)
}
@@ -219,6 +219,10 @@ export function isFileImage(path: string): boolean {
)
}
export function isFilePDF(path: string): boolean {
return path.endsWith('.pdf')
}
export function isFilePlaintext(path: string): boolean {
return getPlaintextExtensions().some(t => path.endsWith(`.${t}`))
}