From be19bae1c56d3fd6e510b1aa83231cce8e3f94cc Mon Sep 17 00:00:00 2001 From: Sam Wilkins Date: Sat, 22 Feb 2020 15:41:41 -0500 Subject: can now update search indices from server --- src/server/ApiManagers/SearchManager.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/ApiManagers/SearchManager.ts b/src/server/ApiManagers/SearchManager.ts index 4ce12f9f3..4bbf31ac5 100644 --- a/src/server/ApiManagers/SearchManager.ts +++ b/src/server/ApiManagers/SearchManager.ts @@ -6,7 +6,7 @@ import * as path from 'path'; import { pathToDirectory, Directory } from "./UploadManager"; import { red, cyan, yellow } from "colors"; import RouteSubscriber from "../RouteSubscriber"; -import { exec } from "child_process"; +import { exec, execSync } from "child_process"; import { onWindows } from ".."; import { get } from "request-promise"; @@ -23,6 +23,10 @@ export class SearchManager extends ApiManager { const status = req.params.action === "start"; const success = await SolrManager.SetRunning(status); console.log(success ? `Successfully ${status ? "started" : "stopped"} Solr!` : `Uh oh! Check the console for the error that occurred while ${status ? "starting" : "stopping"} Solr`); + } else if (action === "update") { + execSync("npx ts-node updateSearch.ts", { cwd: path.resolve(__dirname, "../"), stdio: "inherit" }); + } else { + console.log(yellow(`${action} is an unknown solr operation.`)); } res.redirect("/home"); } -- cgit v1.2.3-70-g09d2