#254 - Fixed Text Extractor indexing when disabled in settings
This commit is contained in:
@@ -11,6 +11,8 @@ import {
|
|||||||
getTagsFromMetadata,
|
getTagsFromMetadata,
|
||||||
isFileCanvas,
|
isFileCanvas,
|
||||||
isFileFromDataloomPlugin,
|
isFileFromDataloomPlugin,
|
||||||
|
isFileImage,
|
||||||
|
isFilePDF,
|
||||||
isFilePlaintext,
|
isFilePlaintext,
|
||||||
isFilenameIndexable,
|
isFilenameIndexable,
|
||||||
logDebug,
|
logDebug,
|
||||||
@@ -20,6 +22,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
|
||||||
@@ -84,8 +87,20 @@ async function getAndMapIndexedDocument(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ** Image or PDF **
|
// ** Image **
|
||||||
else if (extractor?.canFileBeExtracted(path)) {
|
else if (
|
||||||
|
isFileImage(path) &&
|
||||||
|
settings.imagesIndexing &&
|
||||||
|
extractor?.canFileBeExtracted(path)
|
||||||
|
) {
|
||||||
|
content = await extractor.extractText(file)
|
||||||
|
}
|
||||||
|
// ** PDF **
|
||||||
|
else if (
|
||||||
|
isFilePDF(path) &&
|
||||||
|
settings.PDFIndexing &&
|
||||||
|
extractor?.canFileBeExtracted(path)
|
||||||
|
) {
|
||||||
content = await extractor.extractText(file)
|
content = await extractor.extractText(file)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user