Rebuild the inverted index if it doesn't exist on search.

This commit is contained in:
Starbeamrainbowlabs 2015-12-05 17:27:01 +00:00
parent c6442565bf
commit d55132fd19
1 changed files with 5 additions and 0 deletions

View File

@ -30,6 +30,11 @@ register_module([
add_action("search", function() {
global $settings, $env, $pageindex, $paths;
// Create the inverted index if it doesn't exist.
// todo In the future perhaps a CLI for this would be good?
if(!file_exists($paths->searchindex))
search::rebuild_invindex();
if(!isset($_GET["query"]))
exit(page_renderer::render("No Search Terms - Error - $settings->sitename", "<p>You didn't specify any search terms. Try typing some into the box above.</p>"));