#14 - non-existing notes are indexed

This commit is contained in:
Simon Cambier
2022-05-17 22:17:43 +02:00
parent 8c99450d3b
commit 5c2033cd06
8 changed files with 124 additions and 32 deletions

View File

@@ -1,4 +1,5 @@
<script lang="ts">
import { getNoteFromCache } from "src/notes"
import type { ResultNote } from "../globals"
import { getMatches } from "../search"
import { highlighter, makeExcerpt, stringsToRegex } from "../utils"
@@ -10,9 +11,10 @@ export let note: ResultNote
$: reg = stringsToRegex(note.foundWords)
$: matches = getMatches(note.content, reg)
$: cleanedContent = makeExcerpt(note.content, note.matches[0]?.offset ?? -1)
$: glyph = getNoteFromCache(note.path)?.doesNotExist
</script>
<ResultItemContainer id={note.path} {selected} on:mousemove on:click>
<ResultItemContainer id={note.path} {selected} on:mousemove on:click {glyph}>
<span class="omnisearch-result__title">
{@html note.basename.replace(reg, highlighter)}
</span>