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

Fix + weighted word support on stas-parse action

This commit is contained in:
Starbeamrainbowlabs 2019-12-15 20:03:04 +00:00
parent c80f26962e
commit 6f4b1a62e9
Signed by: sbrl
GPG key ID: 1BE5172E637709C2
3 changed files with 12 additions and 1 deletions

View file

@ -3,6 +3,9 @@ This file holds the changelog for Pepperminty Wiki. This is the master list of t
## v0.21-dev ## v0.21-dev
## Fixed
- Fixed weighted word support on search query analysis debug page
## Changed ## Changed
- Improved the search indexing system performance - again - Improved the search indexing system performance - again
- Another search index rebuild is required - Another search index rebuild is required

View file

@ -135,7 +135,7 @@
"version": "0.11", "version": "0.11",
"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": 1576432241, "lastupdate": 1576440066,
"optional": false, "optional": false,
"extra_data": [] "extra_data": []
}, },

View file

@ -340,10 +340,13 @@ register_module([
continue; continue;
} }
$term = null; $term = null;
$token_part = $token; $token_part = $token;
if($token_part[0] == "+") $token_part = substr($token_part, 1);
if(strpos($token_part, ":") !== false) $token_part = explode(":", $token_part, 2)[1]; if(strpos($token_part, ":") !== false) $token_part = explode(":", $token_part, 2)[1];
foreach($stas_query["terms"] as $c_term) { foreach($stas_query["terms"] as $c_term) {
// echo(var_export($token_part, true) . " / {$c_term["term"]}\n");
if($c_term["term"] == $token_part) { if($c_term["term"] == $token_part) {
$term = $c_term; $term = $c_term;
break; break;
@ -360,6 +363,10 @@ register_module([
case -1: $style .= "color: grey; text-decoration: wavy line-through;"; $title = "stop word"; break; case -1: $style .= "color: grey; text-decoration: wavy line-through;"; $title = "stop word"; break;
case 1: $style .= "color: blue;"; $title = "normal word"; break; case 1: $style .= "color: blue;"; $title = "normal word"; break;
} }
if($term["weight"] > 1) {
$style .= "color: darkblue; font-weight: bold;";
$title = "weighted word";
}
if($term["weight"] !== -1) { if($term["weight"] !== -1) {
switch($term["location"]) { switch($term["location"]) {
case "body": $style = "color: cyan"; $title = "body only"; break; case "body": $style = "color: cyan"; $title = "body only"; break;
@ -368,6 +375,7 @@ register_module([
case "all": $title .= ", searching everywhere"; case "all": $title .= ", searching everywhere";
} }
} }
$title .= ", weight: {$term["weight"]}";
$result .= "<span title='$title' style='$style'>$token</span> "; $result .= "<span title='$title' style='$style'>$token</span> ";
} }