diff --git a/src/cache-manager.ts b/src/cache-manager.ts
index 4c4b4f8..90da4a1 100644
--- a/src/cache-manager.ts
+++ b/src/cache-manager.ts
@@ -12,6 +12,7 @@ import {
isFileCanvas,
isFileFromDataloomPlugin,
isFilePlaintext,
+ isFilenameIndexable,
logDebug,
makeMD5,
removeDiacritics,
@@ -87,8 +88,11 @@ async function getAndMapIndexedDocument(
// ** Image or PDF **
else if (extractor?.canFileBeExtracted(path)) {
content = await extractor.extractText(file)
- } else {
- throw new Error(`Unsupported file type: "${path}"`)
+ }
+
+ // ** Unsupported files **
+ else if (isFilenameIndexable(path)) {
+ content = file.path
}
if (content === null || content === undefined) {
diff --git a/src/components/ModalInFile.svelte b/src/components/ModalInFile.svelte
index ab8f376..5b8739a 100644
--- a/src/components/ModalInFile.svelte
+++ b/src/components/ModalInFile.svelte
@@ -18,7 +18,6 @@
import { Query } from 'src/search/query'
import { openNote } from 'src/tools/notes'
import { searchEngine } from 'src/search/omnisearch'
- import { cacheManager } from 'src/cache-manager'
export let modal: OmnisearchInFileModal
export let parent: OmnisearchVaultModal | null = null
diff --git a/src/settings.ts b/src/settings.ts
index 24c7cbe..9f6f438 100644
--- a/src/settings.ts
+++ b/src/settings.ts
@@ -37,6 +37,8 @@ export interface OmnisearchSettings extends WeightingSettings {
imagesIndexing: boolean
/** Enable Dataloom indexing */
dataloomIndexing: boolean
+ /** Enable indexing of unknown files */
+ unsupportedFilesIndexing: 'yes' | 'no' | 'default'
/** Activate the small 🔍 button on Obsidian's ribbon */
ribbonIcon: boolean
/** Display the small contextual excerpt in search results */
@@ -163,28 +165,49 @@ export class SettingsTab extends PluginSettingTab {
)
.setDisabled(!getTextExtractor())
- // Additional files to index
+ // Additional text files to index
const indexedFileTypesDesc = new DocumentFragment()
indexedFileTypesDesc.createSpan({}, span => {
- span.innerHTML = `In addition to standard md files, Omnisearch can also index other plaintext files.
- Add extensions separated by a space, without the dot. Example: "txt org".
+ span.innerHTML = `In addition to standard md files, Omnisearch can also index other PLAINTEXT files.
+ Add extensions separated by a space, without the dot. Example: "txt org csv".
⚠️ Using extensions of non-plaintext files (like .docx or .pptx) WILL cause crashes,
because Omnisearch will try to index their content.
${needsARestart}`
})
new Setting(containerEl)
- .setName('Additional files to index')
+ .setName('Additional TEXT files to index')
.setDesc(indexedFileTypesDesc)
.addText(component => {
component
.setValue(settings.indexedFileTypes.join(' '))
- .setPlaceholder('Example: txt org')
+ .setPlaceholder('Example: txt org csv')
.onChange(async v => {
settings.indexedFileTypes = v.split(' ')
await saveSettings(this.plugin)
})
})
+ // Unsupported files
+ const indexUnsupportedDesc = new DocumentFragment()
+ indexUnsupportedDesc.createSpan({}, span => {
+ span.innerHTML = `
+ Omnisearch can index filenames of "unsupported" files, such as e.g.
.mp4or
.xlsx.