mirror of
https://github.com/sbrl/Pepperminty-Wiki.git
synced 2024-11-22 04:23:01 +00:00
Search tags as well as pages
This commit is contained in:
parent
6b9692c408
commit
3b00f56485
4 changed files with 50 additions and 7 deletions
|
@ -23,6 +23,7 @@ This file holds the changelog for Pepperminty Wiki. This is the master list of t
|
||||||
### Changed
|
### Changed
|
||||||
- Make `invindex-rebuild` admin-only, but allow access if the POST param `secret` is set to your secret in `peppermint.json`
|
- Make `invindex-rebuild` admin-only, but allow access if the POST param `secret` is set to your secret in `peppermint.json`
|
||||||
- Improved the wording of the deletion confirmation and error pages
|
- Improved the wording of the deletion confirmation and error pages
|
||||||
|
- Search now searches matching tags as well as pages
|
||||||
|
|
||||||
## v0.14
|
## v0.14
|
||||||
|
|
||||||
|
|
|
@ -3420,7 +3420,7 @@ register_module([
|
||||||
|
|
||||||
register_module([
|
register_module([
|
||||||
"name" => "Search",
|
"name" => "Search",
|
||||||
"version" => "0.5.1",
|
"version" => "0.6",
|
||||||
"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.",
|
||||||
"id" => "feature-search",
|
"id" => "feature-search",
|
||||||
|
@ -3584,6 +3584,27 @@ register_module([
|
||||||
}
|
}
|
||||||
$content .= "</p>";
|
$content .= "</p>";
|
||||||
|
|
||||||
|
if(module_exists("page-list")) {
|
||||||
|
$nterms = search::tokenize($query);
|
||||||
|
$nterms_regex = implode("|", array_map(function($nterm) {
|
||||||
|
return preg_quote(strtolower(trim($nterm)));
|
||||||
|
}, $nterms));
|
||||||
|
$all_tags = get_all_tags();
|
||||||
|
$matching_tags = [];
|
||||||
|
foreach($all_tags as $tag) {
|
||||||
|
if(preg_match("/$nterms_regex/i", trim($tag)) > 0)
|
||||||
|
$matching_tags[] = $tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(count($matching_tags) > 0) {
|
||||||
|
$content .= "<p>Matching tags: <span class='tags'>";
|
||||||
|
foreach($matching_tags as $tag) {
|
||||||
|
$content .= "\t<a href='?action=list-tags&tag=" . rawurlencode($tag) ."' class='mini-tag'>" . htmlentities($tag) . "</a> \n";
|
||||||
|
}
|
||||||
|
$content .= "</span></p>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$i = 0; // todo use $_GET["offset"] and $_GET["result-count"] or something
|
$i = 0; // todo use $_GET["offset"] and $_GET["result-count"] or something
|
||||||
foreach($results as $result)
|
foreach($results as $result)
|
||||||
{
|
{
|
||||||
|
@ -6522,7 +6543,7 @@ register_module([
|
||||||
|
|
||||||
register_module([
|
register_module([
|
||||||
"name" => "Page list",
|
"name" => "Page list",
|
||||||
"version" => "0.10.4",
|
"version" => "0.11",
|
||||||
"author" => "Starbeamrainbowlabs",
|
"author" => "Starbeamrainbowlabs",
|
||||||
"description" => "Adds a page that lists all the pages in the index along with their metadata.",
|
"description" => "Adds a page that lists all the pages in the index along with their metadata.",
|
||||||
"id" => "page-list",
|
"id" => "page-list",
|
||||||
|
|
|
@ -100,11 +100,11 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Search",
|
"name": "Search",
|
||||||
"version": "0.5.1",
|
"version": "0.6",
|
||||||
"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.",
|
||||||
"id": "feature-search",
|
"id": "feature-search",
|
||||||
"lastupdate": 1503747477,
|
"lastupdate": 1505838750,
|
||||||
"optional": false
|
"optional": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -190,11 +190,11 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Page list",
|
"name": "Page list",
|
||||||
"version": "0.10.4",
|
"version": "0.11",
|
||||||
"author": "Starbeamrainbowlabs",
|
"author": "Starbeamrainbowlabs",
|
||||||
"description": "Adds a page that lists all the pages in the index along with their metadata.",
|
"description": "Adds a page that lists all the pages in the index along with their metadata.",
|
||||||
"id": "page-list",
|
"id": "page-list",
|
||||||
"lastupdate": 1505769039,
|
"lastupdate": 1505769119,
|
||||||
"optional": false
|
"optional": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
register_module([
|
register_module([
|
||||||
"name" => "Search",
|
"name" => "Search",
|
||||||
"version" => "0.5.1",
|
"version" => "0.6",
|
||||||
"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.",
|
||||||
"id" => "feature-search",
|
"id" => "feature-search",
|
||||||
|
@ -165,6 +165,27 @@ register_module([
|
||||||
}
|
}
|
||||||
$content .= "</p>";
|
$content .= "</p>";
|
||||||
|
|
||||||
|
if(module_exists("page-list")) {
|
||||||
|
$nterms = search::tokenize($query);
|
||||||
|
$nterms_regex = implode("|", array_map(function($nterm) {
|
||||||
|
return preg_quote(strtolower(trim($nterm)));
|
||||||
|
}, $nterms));
|
||||||
|
$all_tags = get_all_tags();
|
||||||
|
$matching_tags = [];
|
||||||
|
foreach($all_tags as $tag) {
|
||||||
|
if(preg_match("/$nterms_regex/i", trim($tag)) > 0)
|
||||||
|
$matching_tags[] = $tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(count($matching_tags) > 0) {
|
||||||
|
$content .= "<p>Matching tags: <span class='tags'>";
|
||||||
|
foreach($matching_tags as $tag) {
|
||||||
|
$content .= "\t<a href='?action=list-tags&tag=" . rawurlencode($tag) ."' class='mini-tag'>" . htmlentities($tag) . "</a> \n";
|
||||||
|
}
|
||||||
|
$content .= "</span></p>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$i = 0; // todo use $_GET["offset"] and $_GET["result-count"] or something
|
$i = 0; // todo use $_GET["offset"] and $_GET["result-count"] or something
|
||||||
foreach($results as $result)
|
foreach($results as $result)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue