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

Default to snippet from the page source in search result context generation - some pages may appear when the search terms appear only in the title or tags, and not the page source.

This commit is contained in:
Starbeamrainbowlabs 2017-03-20 20:08:56 +00:00
parent 86ebcf57a0
commit 8404b0cec6
6 changed files with 17 additions and 12 deletions

View file

@ -43,6 +43,7 @@
- Correct error message when attempting to move a page - Correct error message when attempting to move a page
- Improved security of PHP session cookie by setting HttpOnly flag. - Improved security of PHP session cookie by setting HttpOnly flag.
- Linked pages with single quotes (`'`) in their names corectly in page lists. - Linked pages with single quotes (`'`) in their names corectly in page lists.
- Fixed blank descriptions in search results by defaulting to a snippet from the beginning of the page.
## v0.12.1 ## v0.12.1

View file

@ -1977,7 +1977,7 @@ function render_sidebar($pageindex, $root_pagename = "")
register_module([ register_module([
"name" => "Settings GUI", "name" => "Settings GUI",
"version" => "0.1", "version" => "0.1.1",
"author" => "Starbeamrainbowlabs", "author" => "Starbeamrainbowlabs",
"description" => "The module everyone has been waiting for! Adds a web based gui that lets mods change the wiki settings.", "description" => "The module everyone has been waiting for! Adds a web based gui that lets mods change the wiki settings.",
"id" => "feature-guiconfig", "id" => "feature-guiconfig",
@ -2532,7 +2532,7 @@ register_module([
register_module([ register_module([
"name" => "Search", "name" => "Search",
"version" => "0.4", "version" => "0.5",
"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",
@ -2690,6 +2690,8 @@ register_module([
//echo("Extracting context for result " . $result["pagename"] . ".\n"); //echo("Extracting context for result " . $result["pagename"] . ".\n");
$context = search::extract_context($_GET["query"], $pagesource); $context = search::extract_context($_GET["query"], $pagesource);
if(strlen($context) === 0)
$context = substr($pagesource, 0, $settings->search_characters_context * 2);
//echo("'Generated search context for " . $result["pagename"] . ": $context'\n"); //echo("'Generated search context for " . $result["pagename"] . ": $context'\n");
$context = search::highlight_context($_GET["query"], $context); $context = search::highlight_context($_GET["query"], $context);
/*if(strlen($context) == 0) /*if(strlen($context) == 0)
@ -3822,7 +3824,7 @@ function errorimage($text, $target_size)
register_module([ register_module([
"name" => "User Preferences", "name" => "User Preferences",
"version" => "0.2", "version" => "0.2.1",
"author" => "Starbeamrainbowlabs", "author" => "Starbeamrainbowlabs",
"description" => "Adds a user preferences page, letting pople do things like change their email address and password.", "description" => "Adds a user preferences page, letting pople do things like change their email address and password.",
"id" => "feature-user-preferences", "id" => "feature-user-preferences",

View file

@ -46,11 +46,11 @@
}, },
{ {
"name": "Settings GUI", "name": "Settings GUI",
"version": "0.1", "version": "0.1.1",
"author": "Starbeamrainbowlabs", "author": "Starbeamrainbowlabs",
"description": "The module everyone has been waiting for! Adds a web based gui that lets mods change the wiki settings.", "description": "The module everyone has been waiting for! Adds a web based gui that lets mods change the wiki settings.",
"id": "feature-guiconfig", "id": "feature-guiconfig",
"lastupdate": 1490039426, "lastupdate": 1490040335,
"optional": false "optional": false
}, },
{ {
@ -82,11 +82,11 @@
}, },
{ {
"name": "Search", "name": "Search",
"version": "0.4", "version": "0.5",
"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": 1485464071, "lastupdate": 1490040313,
"optional": false "optional": false
}, },
{ {
@ -100,11 +100,11 @@
}, },
{ {
"name": "User Preferences", "name": "User Preferences",
"version": "0.2", "version": "0.2.1",
"author": "Starbeamrainbowlabs", "author": "Starbeamrainbowlabs",
"description": "Adds a user preferences page, letting pople do things like change their email address and password.", "description": "Adds a user preferences page, letting pople do things like change their email address and password.",
"id": "feature-user-preferences", "id": "feature-user-preferences",
"lastupdate": 1490039844, "lastupdate": 1490040319,
"optional": false "optional": false
}, },
{ {

View file

@ -1,7 +1,7 @@
<?php <?php
register_module([ register_module([
"name" => "Settings GUI", "name" => "Settings GUI",
"version" => "0.1", "version" => "0.1.1",
"author" => "Starbeamrainbowlabs", "author" => "Starbeamrainbowlabs",
"description" => "The module everyone has been waiting for! Adds a web based gui that lets mods change the wiki settings.", "description" => "The module everyone has been waiting for! Adds a web based gui that lets mods change the wiki settings.",
"id" => "feature-guiconfig", "id" => "feature-guiconfig",

View file

@ -1,7 +1,7 @@
<?php <?php
register_module([ register_module([
"name" => "Search", "name" => "Search",
"version" => "0.4", "version" => "0.5",
"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",
@ -159,6 +159,8 @@ register_module([
//echo("Extracting context for result " . $result["pagename"] . ".\n"); //echo("Extracting context for result " . $result["pagename"] . ".\n");
$context = search::extract_context($_GET["query"], $pagesource); $context = search::extract_context($_GET["query"], $pagesource);
if(strlen($context) === 0)
$context = substr($pagesource, 0, $settings->search_characters_context * 2);
//echo("'Generated search context for " . $result["pagename"] . ": $context'\n"); //echo("'Generated search context for " . $result["pagename"] . ": $context'\n");
$context = search::highlight_context($_GET["query"], $context); $context = search::highlight_context($_GET["query"], $context);
/*if(strlen($context) == 0) /*if(strlen($context) == 0)

View file

@ -1,7 +1,7 @@
<?php <?php
register_module([ register_module([
"name" => "User Preferences", "name" => "User Preferences",
"version" => "0.2", "version" => "0.2.1",
"author" => "Starbeamrainbowlabs", "author" => "Starbeamrainbowlabs",
"description" => "Adds a user preferences page, letting pople do things like change their email address and password.", "description" => "Adds a user preferences page, letting pople do things like change their email address and password.",
"id" => "feature-user-preferences", "id" => "feature-user-preferences",