Renamed "Omnisearch" into "SearchEngine"
This commit is contained in:
@@ -55,7 +55,7 @@
|
||||
})
|
||||
note =
|
||||
(
|
||||
await plugin.omnisearch.getSuggestions(query, {
|
||||
await plugin.searchEngine.getSuggestions(query, {
|
||||
singleFilePath,
|
||||
})
|
||||
)[0] ?? null
|
||||
|
||||
@@ -144,7 +144,7 @@
|
||||
})
|
||||
cancelableQuery = cancelable(
|
||||
new Promise(resolve => {
|
||||
resolve(plugin.omnisearch.getSuggestions(query))
|
||||
resolve(plugin.searchEngine.getSuggestions(query))
|
||||
})
|
||||
)
|
||||
resultNotes = await cancelableQuery
|
||||
|
||||
@@ -16,7 +16,7 @@ import {
|
||||
import { eventBus, EventNames, indexingStep, IndexingStepType, type TextExtractorApi } from './globals'
|
||||
import { notifyOnIndexed, registerAPI } from './tools/api'
|
||||
import { OmnisearchCache } from './database'
|
||||
import { Omnisearch } from './search/omnisearch'
|
||||
import { SearchEngine } from './search/search-engine'
|
||||
import { CacheManager } from './cache-manager'
|
||||
import { logDebug } from './tools/utils'
|
||||
import { NotesIndexer } from './notes-index'
|
||||
@@ -33,8 +33,7 @@ export default class OmnisearchPlugin extends Plugin {
|
||||
|
||||
public readonly notesIndexer = new NotesIndexer(this)
|
||||
public readonly textProcessor = new TextProcessor(this)
|
||||
// TODO: rename to searchEngine
|
||||
public readonly omnisearch = new Omnisearch(this)
|
||||
public readonly searchEngine = new SearchEngine(this)
|
||||
|
||||
private ribbonButton?: HTMLElement
|
||||
|
||||
@@ -93,7 +92,7 @@ export default class OmnisearchPlugin extends Plugin {
|
||||
},
|
||||
})
|
||||
|
||||
const searchEngine = this.omnisearch
|
||||
const searchEngine = this.searchEngine
|
||||
|
||||
this.app.workspace.onLayoutReady(async () => {
|
||||
// Listeners to keep the search index up-to-date
|
||||
@@ -208,7 +207,7 @@ export default class OmnisearchPlugin extends Plugin {
|
||||
// Map documents in the background
|
||||
// Promise.all(files.map(f => cacheManager.addToLiveCache(f.path)))
|
||||
|
||||
const searchEngine = this.omnisearch
|
||||
const searchEngine = this.searchEngine
|
||||
if (isCacheEnabled()) {
|
||||
console.time('Omnisearch - Loading index from cache')
|
||||
indexingStep.set(IndexingStepType.LoadingCache)
|
||||
|
||||
@@ -17,7 +17,7 @@ export class NotesIndexer {
|
||||
public async refreshIndex(): Promise<void> {
|
||||
const paths = [...this.notesToReindex].map(n => n.path)
|
||||
if (paths.length) {
|
||||
const searchEngine = this.plugin.omnisearch
|
||||
const searchEngine = this.plugin.searchEngine
|
||||
searchEngine.removeFromPaths(paths)
|
||||
await searchEngine.addFromPaths(paths)
|
||||
this.notesToReindex.clear()
|
||||
|
||||
@@ -8,8 +8,7 @@ import { sortBy } from 'lodash-es'
|
||||
import type OmnisearchPlugin from '../main'
|
||||
import { Tokenizer } from './tokenizer'
|
||||
|
||||
// TODO: rename to SearchEngine
|
||||
export class Omnisearch {
|
||||
export class SearchEngine {
|
||||
private tokenizer: Tokenizer
|
||||
private minisearch: MiniSearch
|
||||
/** Map<path, mtime> */
|
||||
@@ -89,7 +89,7 @@ export function getApi(plugin: OmnisearchPlugin) {
|
||||
const query = new Query(q, {
|
||||
ignoreDiacritics: plugin.settings.ignoreDiacritics,
|
||||
})
|
||||
const raw = await plugin.omnisearch.getSuggestions(query)
|
||||
const raw = await plugin.searchEngine.getSuggestions(query)
|
||||
return mapResults(plugin, raw)
|
||||
},
|
||||
registerOnIndexed(cb: () => void): void {
|
||||
|
||||
Reference in New Issue
Block a user