Fixes #90: Re-enables full text search

This commit is contained in:
Zef Hemel
2022-10-19 09:52:29 +02:00
parent e225c926f5
commit 70501bc3e4
13 changed files with 128 additions and 80 deletions
+11 -3
View File
@@ -1,4 +1,4 @@
import { Application, path, Router, SQLite } from "./deps.ts";
import { Application, etag, path, Router, SQLite } from "./deps.ts";
import { Manifest, SilverBulletHooks } from "../common/manifest.ts";
import { loadMarkdownExtensions } from "../common/markdown_ext.ts";
import buildMarkdown from "../common/parser.ts";
@@ -15,7 +15,10 @@ import { DenoCronHook } from "../plugos/hooks/cron.deno.ts";
import { esbuildSyscalls } from "../plugos/syscalls/esbuild.ts";
import { eventSyscalls } from "../plugos/syscalls/event.ts";
import fileSystemSyscalls from "../plugos/syscalls/fs.deno.ts";
import { fullTextSearchSyscalls } from "../plugos/syscalls/fulltext.knex_sqlite.ts";
import {
ensureFTSTable,
fullTextSearchSyscalls,
} from "../plugos/syscalls/fulltext.knex_sqlite.ts";
import sandboxSyscalls from "../plugos/syscalls/sandbox.ts";
import shellSyscalls from "../plugos/syscalls/shell.node.ts";
import {
@@ -43,6 +46,7 @@ export type ServerOptions = {
};
const indexRequiredKey = "$spaceIndexed";
const staticLastModified = new Date().toUTCString();
export class HttpServer {
app: Application;
@@ -198,7 +202,7 @@ export class HttpServer {
async start() {
await ensureIndexTable(this.db);
await ensureStoreTable(this.db, "store");
// await ensureFTSTable(this.db, "fts");
await ensureFTSTable(this.db, "fts");
await this.ensureAndLoadSettings();
// Load plugs
@@ -211,6 +215,8 @@ export class HttpServer {
response.body = this.assetBundle.readTextFileSync(
"web/index.html",
);
response.headers.set("Last-Modified", staticLastModified);
response.headers.set("ETag", await etag.calculate(response.body));
return;
}
try {
@@ -224,6 +230,8 @@ export class HttpServer {
assetName,
);
response.headers.set("Content-length", "" + data.length);
response.headers.set("Last-Modified", staticLastModified);
response.headers.set("ETag", await etag.calculate(data));
if (request.method === "GET") {
response.body = data;