From ad5f84d8264ea402daa8cb619328d85d2e4967e1 Mon Sep 17 00:00:00 2001 From: Simon Cambier Date: Sun, 23 Jul 2023 10:28:54 +0200 Subject: [PATCH] Dataloom files are now always indexed --- src/cache-manager.ts | 3 +- src/settings.ts | 66 +++++++++++++++----------------------------- 2 files changed, 24 insertions(+), 45 deletions(-) diff --git a/src/cache-manager.ts b/src/cache-manager.ts index df7f73f..5ef87a3 100644 --- a/src/cache-manager.ts +++ b/src/cache-manager.ts @@ -20,7 +20,6 @@ import { import type { CanvasData } from 'obsidian/canvas' import type { AsPlainObject } from 'minisearch' import type MiniSearch from 'minisearch' -import { settings } from './settings' /** * This function is responsible for extracting the text from a file and @@ -62,7 +61,7 @@ async function getAndMapIndexedDocument( } // ** Dataloom plugin ** - else if (settings.dataloomIndexing && isFileFromDataloomPlugin(path)) { + else if (isFileFromDataloomPlugin(path)) { try { const data = JSON.parse(await app.vault.cachedRead(file)) // data is a json object, we recursively iterate the keys diff --git a/src/settings.ts b/src/settings.ts index 788b692..249ec24 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -36,8 +36,6 @@ export interface OmnisearchSettings extends WeightingSettings { PDFIndexing: boolean /** Enable Images indexing */ imagesIndexing: boolean - /** Enable Dataloom indexing */ - dataloomIndexing: boolean /** Enable indexing of unknown files */ unsupportedFilesIndexing: 'yes' | 'no' | 'default' /** Activate the small 🔍 button on Obsidian's ribbon */ @@ -149,23 +147,6 @@ export class SettingsTab extends PluginSettingTab { ) .setDisabled(!getTextExtractor()) - // Dataloom Indexing - const indexDataLoomDesc = new DocumentFragment() - indexDataLoomDesc.createSpan({}, span => { - span.innerHTML = `Include DataLoom
.loom
files in search results -
${needsARestart}` - }) - new Setting(containerEl) - .setName('DataLoom indexing (beta)') - .setDesc(indexDataLoomDesc) - .addToggle(toggle => - toggle.setValue(settings.dataloomIndexing).onChange(async v => { - settings.dataloomIndexing = v - await saveSettings(this.plugin) - }) - ) - .setDisabled(!getTextExtractor()) - // Additional text files to index const indexedFileTypesDesc = new DocumentFragment() indexedFileTypesDesc.createSpan({}, span => { @@ -197,7 +178,7 @@ export class SettingsTab extends PluginSettingTab {
${needsARestart}` }) new Setting(containerEl) - .setName('Index unsupported files (beta)') + .setName('Index unsupported files') .setDesc(indexUnsupportedDesc) .addDropdown(dropdown => { dropdown @@ -219,7 +200,7 @@ export class SettingsTab extends PluginSettingTab { new Setting(containerEl) .setName('Save index to cache') .setDesc( - 'Enable caching to speed up indexing time. In rare cases, the cache write may cause a freeze in Obsidian. This option will disable itself if it happens.' + 'Enable caching to speed up indexing time. In rare cases, the cache write may cause a crash in Obsidian. This option will disable itself if it happens.' ) .addToggle(toggle => toggle.setValue(settings.useCache).onChange(async v => { @@ -242,26 +223,6 @@ export class SettingsTab extends PluginSettingTab { }) ) - // Ignore diacritics - const diacriticsDesc = new DocumentFragment() - diacriticsDesc.createSpan({}, span => { - span.innerHTML = `Normalize diacritics in search terms. Words like "brûlée" or "žluťoučký" will be indexed as "brulee" and "zlutoucky".
- ⚠️ You probably should NOT disable this.
- ⚠️ Changing this setting will clear the cache.
- ${needsARestart} - ` - }) - new Setting(containerEl) - .setName('Ignore diacritics') - .setDesc(diacriticsDesc) - .addToggle(toggle => - toggle.setValue(settings.ignoreDiacritics).onChange(async v => { - await database.clearCache() - settings.ignoreDiacritics = v - await saveSettings(this.plugin) - }) - ) - // Split CamelCaseWords const camelCaseDesc = new DocumentFragment() camelCaseDesc.createSpan({}, span => { @@ -474,6 +435,26 @@ export class SettingsTab extends PluginSettingTab { //#region Danger Zone new Setting(containerEl).setName('Danger Zone').setHeading() + // Ignore diacritics + const diacriticsDesc = new DocumentFragment() + diacriticsDesc.createSpan({}, span => { + span.innerHTML = `Normalize diacritics in search terms. Words like "brûlée" or "žluťoučký" will be indexed as "brulee" and "zlutoucky".
+ ⚠️ You probably should NOT disable this.
+ ⚠️ Changing this setting will clear the cache.
+ ${needsARestart} + ` + }) + new Setting(containerEl) + .setName('Ignore diacritics') + .setDesc(diacriticsDesc) + .addToggle(toggle => + toggle.setValue(settings.ignoreDiacritics).onChange(async v => { + await database.clearCache() + settings.ignoreDiacritics = v + await saveSettings(this.plugin) + }) + ) + const disableDesc = new DocumentFragment() disableDesc.createSpan({}, span => { span.innerHTML = `Disable Omnisearch on this device only.
@@ -532,7 +513,6 @@ export const DEFAULT_SETTINGS: OmnisearchSettings = { indexedFileTypes: [] as string[], PDFIndexing: false, imagesIndexing: false, - dataloomIndexing: false, unsupportedFilesIndexing: 'no', splitCamelCase: false, openInNewPane: false, @@ -544,7 +524,7 @@ export const DEFAULT_SETTINGS: OmnisearchSettings = { highlight: true, showPreviousQueryResults: true, simpleSearch: false, - fuzziness: '0', + fuzziness: '1', weightBasename: 3, weightDirectory: 2,