isIndexing as a svelte store
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
let searchQuery: string | undefined
|
||||
let resultNotes: ResultNote[] = []
|
||||
let query: Query
|
||||
let { isIndexing } = SearchEngine
|
||||
|
||||
$: selectedNote = resultNotes[selectedIndex]
|
||||
$: searchQuery = searchQuery ?? previousQuery
|
||||
@@ -210,7 +211,7 @@
|
||||
{/if}
|
||||
</InputSearch>
|
||||
|
||||
{#if SearchEngine.isIndexing}
|
||||
{#if $isIndexing}
|
||||
<div style="text-align: center; color: var(--text-accent); margin-top: 10px">
|
||||
⏳ Omnisearch indexing is currently in progress
|
||||
</div>
|
||||
|
||||
@@ -18,6 +18,7 @@ import {
|
||||
import type { Query } from './query'
|
||||
import { settings } from '../settings'
|
||||
import { cacheManager } from '../cache-manager'
|
||||
import { writable } from 'svelte/store'
|
||||
|
||||
const tokenize = (text: string): string[] => {
|
||||
const tokens = text.split(SPACE_OR_PUNCTUATION)
|
||||
@@ -49,7 +50,7 @@ export const minisearchOptions: Options<IndexedDocument> = {
|
||||
export class SearchEngine {
|
||||
private static engine: SearchEngine
|
||||
private static tmpEngine: SearchEngine
|
||||
public static isIndexing = true
|
||||
public static isIndexing = writable(true)
|
||||
|
||||
/**
|
||||
* The main singleton SearchEngine instance.
|
||||
@@ -93,7 +94,7 @@ export class SearchEngine {
|
||||
*/
|
||||
public static swapEngines(): void {
|
||||
;[this.engine, this.tmpEngine] = [this.tmpEngine, this.engine]
|
||||
this.isIndexing = false
|
||||
this.isIndexing.set(false)
|
||||
}
|
||||
|
||||
private minisearch: MiniSearch
|
||||
|
||||
Reference in New Issue
Block a user