1
0
Fork 0
mirror of https://github.com/sbrl/Pepperminty-Wiki.git synced 2024-11-25 17:23:00 +00:00

Bugfix: Don't search page titles and tags for stop words

This commit is contained in:
Starbeamrainbowlabs 2017-03-23 21:25:55 +00:00
parent 3bf9274647
commit 96fcbb90de
4 changed files with 12 additions and 1 deletions

View file

@ -9,6 +9,7 @@
### Fixed ### Fixed
- Clear the page id index out when rebuilding the search index from scratch. - Clear the page id index out when rebuilding the search index from scratch.
- This is needed to correct some issues where the id index goes all weird and assigns the same id to multiple pages - This is needed to correct some issues where the id index goes all weird and assigns the same id to multiple pages
- Don't search page titles or tags for stop words - it skews results since we don't search the page body for them
## v0.13-beta1 ## v0.13-beta1

View file

@ -3143,6 +3143,11 @@ class search
{ {
$qterm = $query_terms[$i]; $qterm = $query_terms[$i];
// Stop words aren't worth the bother - make sure we don't search
// the title or the tags for them
if(in_array($qterm, self::$stop_words))
continue;
// Only search the inverted index if it actually exists there // Only search the inverted index if it actually exists there
if(isset($invindex[$qterm])) if(isset($invindex[$qterm]))
{ {

View file

@ -86,7 +86,7 @@
"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": 1490303523, "lastupdate": 1490304275,
"optional": false "optional": false
}, },
{ {

View file

@ -598,6 +598,11 @@ class search
{ {
$qterm = $query_terms[$i]; $qterm = $query_terms[$i];
// Stop words aren't worth the bother - make sure we don't search
// the title or the tags for them
if(in_array($qterm, self::$stop_words))
continue;
// Only search the inverted index if it actually exists there // Only search the inverted index if it actually exists there
if(isset($invindex[$qterm])) if(isset($invindex[$qterm]))
{ {