mirror of
https://github.com/sbrl/Pepperminty-Wiki.git
synced 2024-11-25 05:22:59 +00:00
feature-search: remove debugging
This commit is contained in:
parent
31253edff4
commit
36e8fe2a17
2 changed files with 2 additions and 9 deletions
|
@ -152,7 +152,6 @@ register_module([
|
||||||
$start = microtime(true);
|
$start = microtime(true);
|
||||||
// FUTURE: When we implement $_GET["offset"] and $_GET["count"] or something we can optimise here
|
// FUTURE: When we implement $_GET["offset"] and $_GET["count"] or something we can optimise here
|
||||||
foreach($results as $key => &$result) {
|
foreach($results as $key => &$result) {
|
||||||
error_log("[search/context extractor] pagename: {$result["pagename"]}");
|
|
||||||
$filepath = $env->storage_prefix . $result["pagename"] . ".md";
|
$filepath = $env->storage_prefix . $result["pagename"] . ".md";
|
||||||
if(!file_exists($filepath)) {
|
if(!file_exists($filepath)) {
|
||||||
error_log("[pepperminty wiki/$settings->sitename/search] Search engine returned {$result["pagename"]} as a result (maps to $filepath), but it doesn't exist on disk (try rebuilding the search index).");
|
error_log("[pepperminty wiki/$settings->sitename/search] Search engine returned {$result["pagename"]} as a result (maps to $filepath), but it doesn't exist on disk (try rebuilding the search index).");
|
||||||
|
@ -172,15 +171,11 @@ register_module([
|
||||||
$env->perfdata->search_time = round((microtime(true) - $search_start)*1000, 3);
|
$env->perfdata->search_time = round((microtime(true) - $search_start)*1000, 3);
|
||||||
header("x-search-time: {$env->perfdata->search_time}ms");
|
header("x-search-time: {$env->perfdata->search_time}ms");
|
||||||
|
|
||||||
error_log(var_export($results, true));
|
|
||||||
|
|
||||||
if(!empty($_GET["format"]) && $_GET["format"] == "json") {
|
if(!empty($_GET["format"]) && $_GET["format"] == "json") {
|
||||||
header("content-type: application/json");
|
header("content-type: application/json");
|
||||||
$json_results = new stdClass();
|
$json_results = new stdClass();
|
||||||
foreach($results as $key => $result) {
|
foreach($results as $key => $result)
|
||||||
error_log("[search/json] id: $key, pagename: {$result["pagename"]}");
|
|
||||||
$json_results->{$result["pagename"]} = $result;
|
$json_results->{$result["pagename"]} = $result;
|
||||||
}
|
|
||||||
exit(json_encode($json_results));
|
exit(json_encode($json_results));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,12 +233,9 @@ register_module([
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var_dump($results);
|
|
||||||
|
|
||||||
$i = 0; // todo use $_GET["offset"] and $_GET["result-count"] or something
|
$i = 0; // todo use $_GET["offset"] and $_GET["result-count"] or something
|
||||||
foreach($results as $result)
|
foreach($results as $result)
|
||||||
{
|
{
|
||||||
error_log("[search] pagename: {$result["pagename"]}");
|
|
||||||
$link = "?page=" . rawurlencode($result["pagename"]);
|
$link = "?page=" . rawurlencode($result["pagename"]);
|
||||||
$pagesource = file_get_contents($env->storage_prefix . $result["pagename"] . ".md");
|
$pagesource = file_get_contents($env->storage_prefix . $result["pagename"] . ".md");
|
||||||
|
|
||||||
|
|
|
@ -913,6 +913,7 @@ class search
|
||||||
|
|
||||||
// TODO: Remove items if the computed rank is below a threshold
|
// TODO: Remove items if the computed rank is below a threshold
|
||||||
}
|
}
|
||||||
|
unset($pagedata); // Ref https://bugs.php.net/bug.php?id=70387
|
||||||
|
|
||||||
uasort($matching_pages, function($a, $b) {
|
uasort($matching_pages, function($a, $b) {
|
||||||
if($a["rank"] == $b["rank"]) return 0;
|
if($a["rank"] == $b["rank"]) return 0;
|
||||||
|
|
Loading…
Reference in a new issue