Add explanation for search_index file

This commit is contained in:
2024-03-15 22:16:28 +01:00
parent 7024648712
commit 420eddf615
6 changed files with 61 additions and 8 deletions

View File

@@ -287,17 +287,17 @@ section {
}
.highlight_green {
background-color: rgba(0, 255, 0, 0.05);
background-color: rgba(0, 255, 0, 0.1);
border-color: #00D000;
}
.highlight_blue {
background-color: rgba(32, 32, 255, 0.2);
background-color: rgba(0, 0, 255, 0.1);
border-color: #3636FF;
}
.highlight_yellow {
background-color: rgba(255, 255, 0, 0.05);
background-color: rgba(255, 255, 0, 0.1);
border-color: #A0A000;
}

View File

@@ -69,8 +69,9 @@ let sort = (field) => {
<tbody>
{#each peers as peer (peer.address)}
<tr style="border: none;"
class:highlight_red={peer.free_space < peer.min_free_space / 2 || !peer.reachable}
class:highlight_yellow={peer.free_space < peer.min_free_space}
class:highlight_red={!peer.reachable}
class:highlight_yellow={peer.free_space < peer.min_free_space / 2}
class:highlight_blue={peer.free_space < peer.min_free_space}
class:highlight_green={peer.reachable}
animate:flip={{duration: 1000}}
>

View File

@@ -60,6 +60,10 @@ const update_base = async base => {
}
const close_socket = () => {
// Clear this path so the update_base function does not instantly return
// with the next retry
connected_to = ""
if (socket !== null) {
// Disable the error handler so it doesn't start retrying the connection
socket.onerror = null

View File

@@ -41,7 +41,7 @@ onMount(() => {
<FileTitle title={state.base.name}/>
<TextBlock>
<TextBlock width="1000px">
<audio
bind:this={player}
class="player"

View File

@@ -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);

View File

@@ -37,8 +37,11 @@ onMount(() => {
{:else if patreon_result === "error"}
<div class="highlight_red">
<p>
An error occurred while linking Patreon subscription. Please try
again later.
An error occurred while linking Patreon subscription. Check if
there are any Pixeldrain integrations under "Logged in with
Patreon" on this page: <a
href="https://www.patreon.com/settings/apps">https://www.patreon.com/settings/apps</a>.
Try disconnecting all Pixeldrain logins and try again.
</p>
<p>
If it has been more than 30 minutes, your payment is complete and