Tweaked values for resources management
This commit is contained in:
@@ -98,7 +98,7 @@ export async function initGlobalSearchIndex(): Promise<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Read and index all the files into the search engine
|
// Read and index all the files into the search engine
|
||||||
const queue = pLimit(10)
|
const queue = pLimit(settings.backgroundProcesses)
|
||||||
const input = []
|
const input = []
|
||||||
for (const file of files) {
|
for (const file of files) {
|
||||||
if (cacheManager.getNoteFromMemCache(file.path)) {
|
if (cacheManager.getNoteFromMemCache(file.path)) {
|
||||||
@@ -136,7 +136,6 @@ export async function initGlobalSearchIndex(): Promise<void> {
|
|||||||
async function search(query: Query): Promise<SearchResult[]> {
|
async function search(query: Query): Promise<SearchResult[]> {
|
||||||
if (!query.segmentsToStr()) return []
|
if (!query.segmentsToStr()) return []
|
||||||
|
|
||||||
console.time('Omnisearch - searching')
|
|
||||||
let results = minisearchInstance.search(query.segmentsToStr(), {
|
let results = minisearchInstance.search(query.segmentsToStr(), {
|
||||||
prefix: true,
|
prefix: true,
|
||||||
fuzzy: term => (term.length > 4 ? 0.2 : false),
|
fuzzy: term => (term.length > 4 ? 0.2 : false),
|
||||||
@@ -149,7 +148,6 @@ async function search(query: Query): Promise<SearchResult[]> {
|
|||||||
headings3: settings.weightH3,
|
headings3: settings.weightH3,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
console.timeEnd('Omnisearch - searching')
|
|
||||||
|
|
||||||
// Downrank files that are in Obsidian's excluded list
|
// Downrank files that are in Obsidian's excluded list
|
||||||
if (settings.respectExcluded) {
|
if (settings.respectExcluded) {
|
||||||
|
|||||||
@@ -334,14 +334,20 @@ export class SettingsTab extends PluginSettingTab {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Determining the maximum concurrent processes/workers/promises for heavy work,
|
||||||
|
// without hogging all the resources.
|
||||||
|
const cpuCount = Platform.isMobileApp ? 1 : require('os').cpus().length
|
||||||
|
let backgroundProcesses = Math.max(1, Math.floor(cpuCount * 0.75))
|
||||||
|
if (backgroundProcesses == cpuCount) {
|
||||||
|
backgroundProcesses = 1
|
||||||
|
}
|
||||||
|
|
||||||
export const DEFAULT_SETTINGS: OmnisearchSettings = {
|
export const DEFAULT_SETTINGS: OmnisearchSettings = {
|
||||||
respectExcluded: true,
|
respectExcluded: true,
|
||||||
ignoreDiacritics: true,
|
ignoreDiacritics: true,
|
||||||
indexedFileTypes: [] as string[],
|
indexedFileTypes: [] as string[],
|
||||||
PDFIndexing: false,
|
PDFIndexing: false,
|
||||||
backgroundProcesses: Platform.isMobileApp
|
backgroundProcesses,
|
||||||
? 1
|
|
||||||
: Math.max(1, Math.floor(require('os').cpus().length * 0.75)),
|
|
||||||
|
|
||||||
showIndexingNotices: false,
|
showIndexingNotices: false,
|
||||||
showShortName: false,
|
showShortName: false,
|
||||||
|
|||||||
Reference in New Issue
Block a user