From 67648199d7ebd8a1b2ec400af0192dc0bb94b233 Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Tue, 26 Jun 2018 00:11:01 +0100 Subject: [PATCH] Add search time header for analysis purposes --- build/index.php | 8 +++++--- module_index.json | 2 +- modules/feature-search.php | 6 ++++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/build/index.php b/build/index.php index b649a42..ec046d6 100644 --- a/build/index.php +++ b/build/index.php @@ -397,7 +397,7 @@ if($settings->sessionprefix == "auto") ///////////////////////////////////////////////////////////////////////////// /** The version of Pepperminty Wiki currently running. */ $version = "v0.17-dev"; -$commit = "93494b672938d2fb456138e03db5be3803bc51b7"; +$commit = "75b6b6c55fa9710d82b6623971581db7c6c5309b"; /// Environment /// /** Holds information about the current request environment. */ $env = new stdClass(); @@ -3789,6 +3789,10 @@ register_module([ ); } + $env->perfdata->search_time = round((microtime(true) - $search_start)*1000, 3); + + header("x-search-time: {$env->perfdata->search_time}ms"); + if(!empty($_GET["format"]) && $_GET["format"] == "json") { header("content-type: application/json"); $json_results = new stdClass(); @@ -3796,8 +3800,6 @@ register_module([ exit(json_encode($json_results)); } - $env->perfdata->search_time = round((microtime(true) - $search_start)*1000, 3); - $title = $_GET["query"] . " - Search results - $settings->sitename"; $content = "
\n"; diff --git a/module_index.json b/module_index.json index 6f5a722..7e7d937 100755 --- a/module_index.json +++ b/module_index.json @@ -104,7 +104,7 @@ "author": "Starbeamrainbowlabs", "description": "Adds proper search functionality to Pepperminty Wiki using an inverted index to provide a full text search engine. If pages don't show up, then you might have hit a stop word. If not, try requesting the `invindex-rebuild` action to rebuild the inverted index from scratch.", "id": "feature-search", - "lastupdate": 1529967930, + "lastupdate": 1529968213, "optional": false }, { diff --git a/modules/feature-search.php b/modules/feature-search.php index efbd33f..b959bf0 100644 --- a/modules/feature-search.php +++ b/modules/feature-search.php @@ -145,6 +145,10 @@ register_module([ ); } + $env->perfdata->search_time = round((microtime(true) - $search_start)*1000, 3); + + header("x-search-time: {$env->perfdata->search_time}ms"); + if(!empty($_GET["format"]) && $_GET["format"] == "json") { header("content-type: application/json"); $json_results = new stdClass(); @@ -152,8 +156,6 @@ register_module([ exit(json_encode($json_results)); } - $env->perfdata->search_time = round((microtime(true) - $search_start)*1000, 3); - $title = $_GET["query"] . " - Search results - $settings->sitename"; $content = "
\n";