#256 - .loom indexing is behind a setting for now
This commit is contained in:
@@ -19,6 +19,7 @@ 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
|
||||||
@@ -60,7 +61,7 @@ async function getAndMapIndexedDocument(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ** Dataloom plugin **
|
// ** Dataloom plugin **
|
||||||
else if (isFileFromDataloomPlugin(path)) {
|
else if (settings.dataloomIndexing && 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
|
||||||
|
|||||||
@@ -33,8 +33,10 @@ export interface OmnisearchSettings extends WeightingSettings {
|
|||||||
indexedFileTypes: string[]
|
indexedFileTypes: string[]
|
||||||
/** Enable PDF indexing */
|
/** Enable PDF indexing */
|
||||||
PDFIndexing: boolean
|
PDFIndexing: boolean
|
||||||
/** Enable PDF indexing */
|
/** Enable Images indexing */
|
||||||
imagesIndexing: boolean
|
imagesIndexing: boolean
|
||||||
|
/** Enable Dataloom indexing */
|
||||||
|
dataloomIndexing: boolean
|
||||||
/** Activate the small 🔍 button on Obsidian's ribbon */
|
/** Activate the small 🔍 button on Obsidian's ribbon */
|
||||||
ribbonIcon: boolean
|
ribbonIcon: boolean
|
||||||
/** Display the small contextual excerpt in search results */
|
/** Display the small contextual excerpt in search results */
|
||||||
@@ -144,6 +146,23 @@ 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 files to index
|
// Additional files to index
|
||||||
const indexedFileTypesDesc = new DocumentFragment()
|
const indexedFileTypesDesc = new DocumentFragment()
|
||||||
indexedFileTypesDesc.createSpan({}, span => {
|
indexedFileTypesDesc.createSpan({}, span => {
|
||||||
@@ -485,6 +504,7 @@ export const DEFAULT_SETTINGS: OmnisearchSettings = {
|
|||||||
indexedFileTypes: [] as string[],
|
indexedFileTypes: [] as string[],
|
||||||
PDFIndexing: false,
|
PDFIndexing: false,
|
||||||
imagesIndexing: false,
|
imagesIndexing: false,
|
||||||
|
dataloomIndexing: false,
|
||||||
splitCamelCase: false,
|
splitCamelCase: false,
|
||||||
openInNewPane: false,
|
openInNewPane: false,
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user