Add explanation for search_index file
This commit is contained in:
@@ -41,7 +41,7 @@ onMount(() => {
|
||||
|
||||
<FileTitle title={state.base.name}/>
|
||||
|
||||
<TextBlock>
|
||||
<TextBlock width="1000px">
|
||||
<audio
|
||||
bind:this={player}
|
||||
class="player"
|
||||
|
@@ -2,6 +2,7 @@
|
||||
import { createEventDispatcher } from "svelte";
|
||||
import IconBlock from "../../file_viewer/viewers/IconBlock.svelte";
|
||||
import { fs_thumbnail_url } from "../FilesystemUtil";
|
||||
import TextBlock from "../../file_viewer/viewers/TextBlock.svelte";
|
||||
let dispatch = createEventDispatcher()
|
||||
|
||||
export let state
|
||||
@@ -21,6 +22,50 @@ export let state
|
||||
</button>
|
||||
</IconBlock>
|
||||
|
||||
{#if state.base.path === "/me/.search_index.gz"}
|
||||
<TextBlock>
|
||||
<p>
|
||||
Congratulations! You have found the search index. One of the
|
||||
filesystem's dirty little secrets.
|
||||
</p>
|
||||
<p>
|
||||
I needed a place to store an index of each user's files so I could
|
||||
make them searchable. Now, there are search databases like
|
||||
ElasticSearch and such, but that's a lot of work to set up and
|
||||
maintain.. Instead I opted to simply put the full path of every file
|
||||
in your filesystem in a text file. That's what you're looking at
|
||||
here. That can add up to a lot of data, but since the paths usually
|
||||
have a lot of repetitive elements it compresses incredibly well.
|
||||
You'd be hard-pressed to grow this index over even 1 MB. Honestly,
|
||||
this search system is incredibly efficient, I'd be surprised if
|
||||
EleasticSearch could even match it.
|
||||
</p>
|
||||
<p>
|
||||
This file is updated 10 minutes after the last time you modify a
|
||||
file on your filesystem. So if you're constantly uploading and
|
||||
deleting files your search index might never update and you will be
|
||||
left with stale search results.
|
||||
</p>
|
||||
<p>
|
||||
If you delete this file then search will stop working until the file
|
||||
is regenerated 10 minutes later. If you replace this file with a
|
||||
different file then that file will be overwritten 10 minutes later.
|
||||
And if you replace this file with a directory with the same name
|
||||
then search will stop working completely until you delete the
|
||||
directory (yes, I tested this case).
|
||||
</p>
|
||||
<p>
|
||||
Each time you type a search term in the search dialog this file gets
|
||||
decompressed and searched on the fly. There is no trickery here, the
|
||||
file simply gets read line by line. Modern CPUs are incredibly good
|
||||
at searching for text. I benchmarked it once, I don't remember the
|
||||
exact numbers but it was somewhere along the lines of one gigabyte
|
||||
of text per second. Fast enough to be unnoticeable even if you have
|
||||
millions of files in your filesystem.
|
||||
</p>
|
||||
</TextBlock>
|
||||
{/if}
|
||||
|
||||
<style>
|
||||
h1 {
|
||||
text-shadow: 1px 1px 3px var(--shadow_color);
|
||||
|
Reference in New Issue
Block a user