Merge branch 'develop'
This commit is contained in:
@@ -20,7 +20,6 @@ import {
|
|||||||
import type { CanvasData } from 'obsidian/canvas'
|
import type { CanvasData } from 'obsidian/canvas'
|
||||||
import type { AsPlainObject } from 'minisearch'
|
import type { AsPlainObject } from 'minisearch'
|
||||||
import type MiniSearch from 'minisearch'
|
import type MiniSearch from 'minisearch'
|
||||||
import { settings } from './settings'
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function is responsible for extracting the text from a file and
|
* This function is responsible for extracting the text from a file and
|
||||||
@@ -62,7 +61,7 @@ async function getAndMapIndexedDocument(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ** Dataloom plugin **
|
// ** Dataloom plugin **
|
||||||
else if (settings.dataloomIndexing && isFileFromDataloomPlugin(path)) {
|
else if (isFileFromDataloomPlugin(path)) {
|
||||||
try {
|
try {
|
||||||
const data = JSON.parse(await app.vault.cachedRead(file))
|
const data = JSON.parse(await app.vault.cachedRead(file))
|
||||||
// data is a json object, we recursively iterate the keys
|
// data is a json object, we recursively iterate the keys
|
||||||
|
|||||||
@@ -36,8 +36,6 @@ export interface OmnisearchSettings extends WeightingSettings {
|
|||||||
PDFIndexing: boolean
|
PDFIndexing: boolean
|
||||||
/** Enable Images indexing */
|
/** Enable Images indexing */
|
||||||
imagesIndexing: boolean
|
imagesIndexing: boolean
|
||||||
/** Enable Dataloom indexing */
|
|
||||||
dataloomIndexing: boolean
|
|
||||||
/** Enable indexing of unknown files */
|
/** Enable indexing of unknown files */
|
||||||
unsupportedFilesIndexing: 'yes' | 'no' | 'default'
|
unsupportedFilesIndexing: 'yes' | 'no' | 'default'
|
||||||
/** Activate the small 🔍 button on Obsidian's ribbon */
|
/** Activate the small 🔍 button on Obsidian's ribbon */
|
||||||
@@ -149,23 +147,6 @@ export class SettingsTab extends PluginSettingTab {
|
|||||||
)
|
)
|
||||||
.setDisabled(!getTextExtractor())
|
.setDisabled(!getTextExtractor())
|
||||||
|
|
||||||
// Dataloom Indexing
|
|
||||||
const indexDataLoomDesc = new DocumentFragment()
|
|
||||||
indexDataLoomDesc.createSpan({}, span => {
|
|
||||||
span.innerHTML = `Include <a href="https://github.com/trey-wallis/obsidian-dataloom">DataLoom</a> <pre style="display:inline">.loom</pre> files in search results
|
|
||||||
<br/>${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
|
// Additional text files to index
|
||||||
const indexedFileTypesDesc = new DocumentFragment()
|
const indexedFileTypesDesc = new DocumentFragment()
|
||||||
indexedFileTypesDesc.createSpan({}, span => {
|
indexedFileTypesDesc.createSpan({}, span => {
|
||||||
@@ -197,7 +178,7 @@ export class SettingsTab extends PluginSettingTab {
|
|||||||
<br />${needsARestart}`
|
<br />${needsARestart}`
|
||||||
})
|
})
|
||||||
new Setting(containerEl)
|
new Setting(containerEl)
|
||||||
.setName('Index unsupported files (beta)')
|
.setName('Index unsupported files')
|
||||||
.setDesc(indexUnsupportedDesc)
|
.setDesc(indexUnsupportedDesc)
|
||||||
.addDropdown(dropdown => {
|
.addDropdown(dropdown => {
|
||||||
dropdown
|
dropdown
|
||||||
@@ -219,7 +200,7 @@ export class SettingsTab extends PluginSettingTab {
|
|||||||
new Setting(containerEl)
|
new Setting(containerEl)
|
||||||
.setName('Save index to cache')
|
.setName('Save index to cache')
|
||||||
.setDesc(
|
.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 =>
|
.addToggle(toggle =>
|
||||||
toggle.setValue(settings.useCache).onChange(async v => {
|
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".<br/>
|
|
||||||
⚠️ <span style="color: var(--text-accent)">You probably should <strong>NOT</strong> disable this.</span><br>
|
|
||||||
⚠️ <span style="color: var(--text-accent)">Changing this setting will clear the cache.</span><br>
|
|
||||||
${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
|
// Split CamelCaseWords
|
||||||
const camelCaseDesc = new DocumentFragment()
|
const camelCaseDesc = new DocumentFragment()
|
||||||
camelCaseDesc.createSpan({}, span => {
|
camelCaseDesc.createSpan({}, span => {
|
||||||
@@ -474,6 +435,26 @@ export class SettingsTab extends PluginSettingTab {
|
|||||||
//#region Danger Zone
|
//#region Danger Zone
|
||||||
new Setting(containerEl).setName('Danger Zone').setHeading()
|
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".<br/>
|
||||||
|
⚠️ <span style="color: var(--text-accent)">You probably should <strong>NOT</strong> disable this.</span><br>
|
||||||
|
⚠️ <span style="color: var(--text-accent)">Changing this setting will clear the cache.</span><br>
|
||||||
|
${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()
|
const disableDesc = new DocumentFragment()
|
||||||
disableDesc.createSpan({}, span => {
|
disableDesc.createSpan({}, span => {
|
||||||
span.innerHTML = `Disable Omnisearch on this device only.<br>
|
span.innerHTML = `Disable Omnisearch on this device only.<br>
|
||||||
@@ -532,7 +513,6 @@ export const DEFAULT_SETTINGS: OmnisearchSettings = {
|
|||||||
indexedFileTypes: [] as string[],
|
indexedFileTypes: [] as string[],
|
||||||
PDFIndexing: false,
|
PDFIndexing: false,
|
||||||
imagesIndexing: false,
|
imagesIndexing: false,
|
||||||
dataloomIndexing: false,
|
|
||||||
unsupportedFilesIndexing: 'no',
|
unsupportedFilesIndexing: 'no',
|
||||||
splitCamelCase: false,
|
splitCamelCase: false,
|
||||||
openInNewPane: false,
|
openInNewPane: false,
|
||||||
@@ -544,7 +524,7 @@ export const DEFAULT_SETTINGS: OmnisearchSettings = {
|
|||||||
highlight: true,
|
highlight: true,
|
||||||
showPreviousQueryResults: true,
|
showPreviousQueryResults: true,
|
||||||
simpleSearch: false,
|
simpleSearch: false,
|
||||||
fuzziness: '0',
|
fuzziness: '1',
|
||||||
|
|
||||||
weightBasename: 3,
|
weightBasename: 3,
|
||||||
weightDirectory: 2,
|
weightDirectory: 2,
|
||||||
|
|||||||
Reference in New Issue
Block a user