From eda54046a40c108e993cb8efd73a1a36bcbfd225 Mon Sep 17 00:00:00 2001
From: alex <alex@alexloehr.net>
Date: Fri, 20 Jun 2025 08:58:35 +0000
Subject: [PATCH] GS-2156
---
app.js | 34 ++++++++++++++++++++++------------
1 files changed, 22 insertions(+), 12 deletions(-)
diff --git a/app.js b/app.js
index e31d23f..3928423 100644
--- a/app.js
+++ b/app.js
@@ -37,18 +37,28 @@
const searchLib = require("./lib/search")
searchLib.doIndex().catch(console.error)
-fastify.get("/api/search/user", async function (req, res) {
- console.log(req.query)
- const search = req.query?.search
- if (!search) {
- return res.code(422).send({status: "error", msg: "no search"})
- }
- else {
- console.log(search)
- const data = await searchLib.search(search)
- return res.send(data)
- }
-})
+fastify
+ .get("/api/search/user", async function (req, res) {
+ console.log(req.query)
+ const search = req.query?.search
+ if (!search) {
+ return res.code(422).send({status: "error", msg: "no search"})
+ }
+ else {
+ console.log(search)
+ const data = await searchLib.search(search)
+ return res.send(data)
+ }
+ })
+ .post("/api/search/reindex", async function (req, res) {
+ console.log("REINDEX ++++")
+ const start = Date.now()
+ await searchLib.doIndex().catch(console.error)
+ return res.send({
+ status: "ok",
+ msg: `reindexed in ${Date.now() - start} ms`,
+ })
+ })
fastify
/////// USER ////////////////////////////////////////////////////////////////
--
Gitblit v1.8.0