From 6f4b1a62e90a5fe55263110b083bec48af9801e8 Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Sun, 15 Dec 2019 20:03:04 +0000 Subject: [PATCH] Fix + weighted word support on stas-parse action --- Changelog.md | 3 +++ module_index.json | 2 +- modules/feature-search.php | 8 ++++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Changelog.md b/Changelog.md index 267ac3f..bd1f926 100644 --- a/Changelog.md +++ b/Changelog.md @@ -3,6 +3,9 @@ This file holds the changelog for Pepperminty Wiki. This is the master list of t ## v0.21-dev +## Fixed + - Fixed weighted word support on search query analysis debug page + ## Changed - Improved the search indexing system performance - again - Another search index rebuild is required diff --git a/module_index.json b/module_index.json index c4cdc85..f3f4fb7 100755 --- a/module_index.json +++ b/module_index.json @@ -135,7 +135,7 @@ "version": "0.11", "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": 1576432241, + "lastupdate": 1576440066, "optional": false, "extra_data": [] }, diff --git a/modules/feature-search.php b/modules/feature-search.php index 3c970f3..1027a50 100644 --- a/modules/feature-search.php +++ b/modules/feature-search.php @@ -340,10 +340,13 @@ register_module([ continue; } + $term = null; $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]; foreach($stas_query["terms"] as $c_term) { + // echo(var_export($token_part, true) . " / {$c_term["term"]}\n"); if($c_term["term"] == $token_part) { $term = $c_term; 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: blue;"; $title = "normal word"; break; } + if($term["weight"] > 1) { + $style .= "color: darkblue; font-weight: bold;"; + $title = "weighted word"; + } if($term["weight"] !== -1) { switch($term["location"]) { case "body": $style = "color: cyan"; $title = "body only"; break; @@ -368,6 +375,7 @@ register_module([ case "all": $title .= ", searching everywhere"; } } + $title .= ", weight: {$term["weight"]}"; $result .= "$token "; }