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
- Improved security of PHP session cookie by setting HttpOnly flag.
- 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

View File

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

View File

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

View File

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

View File

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

View File

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