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:
parent
4d51ae924e
commit
276b4c808f
2 changed files with 11 additions and 7 deletions
|
@ -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": []
|
||||||
},
|
},
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1180,7 +1184,7 @@ class search
|
||||||
|
|
||||||
// Loop over the pageindex and search the titles / tags
|
// Loop over the pageindex and search the titles / tags
|
||||||
reset($pageindex); // Reset array/object pointer
|
reset($pageindex); // Reset array/object pointer
|
||||||
foreach ($pageindex as $pagename => $pagedata) {
|
foreach($pageindex as $pagename => $pagedata) {
|
||||||
// Setup a variable to hold the current page's id
|
// Setup a variable to hold the current page's id
|
||||||
$pageid = null; // Cache the page id
|
$pageid = null; // Cache the page id
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue