1
0
Fork 0
mirror of https://github.com/sbrl/Pepperminty-Wiki.git synced 2024-11-22 16:33:00 +00:00

Add STAS parsing to query-searchindex output

This commit is contained in:
Starbeamrainbowlabs 2019-08-23 00:51:39 +01:00
parent 4d51ae924e
commit 276b4c808f
Signed by: sbrl
GPG key ID: 1BE5172E637709C2
2 changed files with 11 additions and 7 deletions

View file

@ -135,7 +135,7 @@
"version": "0.10", "version": "0.10",
"author": "Starbeamrainbowlabs", "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.", "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.",
"lastupdate": 1566508630, "lastupdate": 1566517659,
"optional": false, "optional": false,
"extra_data": [] "extra_data": []
}, },

View file

@ -300,10 +300,10 @@ register_module([
} }
$env->perfdata->searchindex_decode_start = microtime(true); $env->perfdata->searchindex_decode_start = microtime(true);
$searchIndex = search::invindex_load($paths->searchindex); search::invindex_load($paths->searchindex);
$env->perfdata->searchindex_decode_time = (microtime(true) - $env->perfdata->searchindex_decode_start) * 1000; $env->perfdata->searchindex_decode_time = (microtime(true) - $env->perfdata->searchindex_decode_start) * 1000;
$env->perfdata->searchindex_query_start = microtime(true); $env->perfdata->searchindex_query_start = microtime(true);
$searchResults = search::invindex_query($_GET["query"], $searchIndex); $searchResults = search::invindex_query($_GET["query"]);
$env->perfdata->searchindex_query_time = (microtime(true) - $env->perfdata->searchindex_query_start) * 1000; $env->perfdata->searchindex_query_time = (microtime(true) - $env->perfdata->searchindex_query_start) * 1000;
header("content-type: application/json"); header("content-type: application/json");
@ -312,6 +312,7 @@ register_module([
$result->decode_time = $env->perfdata->searchindex_decode_time; $result->decode_time = $env->perfdata->searchindex_decode_time;
$result->query_time = $env->perfdata->searchindex_query_time; $result->query_time = $env->perfdata->searchindex_query_time;
$result->total_time = $result->decode_time + $result->query_time; $result->total_time = $result->decode_time + $result->query_time;
$result->stas = search::stas_parse(search::stas_split($_GET["query"]));
$result->search_results = $searchResults; $result->search_results = $searchResults;
exit(json_encode($result, JSON_PRETTY_PRINT)); exit(json_encode($result, JSON_PRETTY_PRINT));
}); });
@ -684,7 +685,10 @@ class search
* @var StorageBox * @var StorageBox
*/ */
private static $invindex = null; private static $invindex = null;
/**
* Cache variable for the transliterator instance used by search::transliterate.
* @var Transliterator
*/
private static $literator = null; private static $literator = null;
/** /**