diff options
author | Sam Wilkins <samwilkins333@gmail.com> | 2020-02-22 15:41:41 -0500 |
---|---|---|
committer | Sam Wilkins <samwilkins333@gmail.com> | 2020-02-22 15:41:41 -0500 |
commit | be19bae1c56d3fd6e510b1aa83231cce8e3f94cc (patch) | |
tree | 52e48f206c8d50f24a3336a442d478074c2ee974 /src/server | |
parent | f0dde351fcb6f8ba1d0e329375e0d86c20162603 (diff) |
can now update search indices from server
Diffstat (limited to 'src/server')
-rw-r--r-- | src/server/ApiManagers/SearchManager.ts | 6 |
1 files changed, 5 insertions, 1 deletions
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"); } |