Add search time header for analysis purposes

This commit is contained in:
Starbeamrainbowlabs 2018-06-26 00:11:01 +01:00
parent 75b6b6c55f
commit 67648199d7
Signed by: sbrl
GPG Key ID: 1BE5172E637709C2
3 changed files with 10 additions and 6 deletions

View File

@ -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 = "<section>\n";

View File

@ -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
},
{

View File

@ -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 = "<section>\n";