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",
|
||||
"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.",
|
||||
"lastupdate": 1566508630,
|
||||
"lastupdate": 1566517659,
|
||||
"optional": false,
|
||||
"extra_data": []
|
||||
},
|
||||
|
|
|
@ -300,10 +300,10 @@ register_module([
|
|||
}
|
||||
|
||||
$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_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;
|
||||
|
||||
header("content-type: application/json");
|
||||
|
@ -312,6 +312,7 @@ register_module([
|
|||
$result->decode_time = $env->perfdata->searchindex_decode_time;
|
||||
$result->query_time = $env->perfdata->searchindex_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;
|
||||
exit(json_encode($result, JSON_PRETTY_PRINT));
|
||||
});
|
||||
|
@ -684,7 +685,10 @@ class search
|
|||
* @var StorageBox
|
||||
*/
|
||||
private static $invindex = null;
|
||||
|
||||
/**
|
||||
* Cache variable for the transliterator instance used by search::transliterate.
|
||||
* @var Transliterator
|
||||
*/
|
||||
private static $literator = null;
|
||||
|
||||
/**
|
||||
|
@ -1020,8 +1024,8 @@ class search
|
|||
];
|
||||
// foreach($operators as $op)
|
||||
// $result[$op] = [];
|
||||
|
||||
|
||||
|
||||
|
||||
$count = count($tokens);
|
||||
for($i = count($tokens) - 1; $i >= 0; $i--) {
|
||||
// Look for excludes
|
||||
|
@ -1180,7 +1184,7 @@ class search
|
|||
|
||||
// Loop over the pageindex and search the titles / tags
|
||||
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
|
||||
$pageid = null; // Cache the page id
|
||||
|
||||
|
|
Loading…
Reference in a new issue