mirror of
https://github.com/sbrl/Pepperminty-Wiki.git
synced 2024-11-22 04:23:01 +00:00
Fix intitle: & intags: syntax - game, set, match.
This commit is contained in:
parent
9505e0653e
commit
4d51ae924e
2 changed files with 6 additions and 4 deletions
|
@ -135,7 +135,7 @@
|
|||
"version": "0.10",
|
||||
"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": 1566508042,
|
||||
"lastupdate": 1566508630,
|
||||
"optional": false,
|
||||
"extra_data": []
|
||||
},
|
||||
|
|
|
@ -1003,6 +1003,8 @@ class search
|
|||
* @param string[] $tokens The array of query tokens to parse.
|
||||
*/
|
||||
public function stas_parse($tokens) {
|
||||
global $settings;
|
||||
|
||||
/* Supported Syntax *
|
||||
*
|
||||
* -term exclude a term
|
||||
|
@ -1173,7 +1175,7 @@ class search
|
|||
foreach($query_stas["terms"] as $term_def) {
|
||||
// No need to skip stop words here, since we're doing a normal
|
||||
// sequential search anyway
|
||||
if(!in_array($term_def["location"], ["all", "intitle", "intags"]))
|
||||
if(!in_array($term_def["location"], ["all", "title", "tags"]))
|
||||
continue; // Skip terms we shouldn't search the page body for
|
||||
|
||||
// Loop over the pageindex and search the titles / tags
|
||||
|
@ -1199,7 +1201,7 @@ class search
|
|||
if($skip) continue;
|
||||
|
||||
// Consider matches in the page title
|
||||
if(in_array($term_def["location"], ["all", "intitle"])) {
|
||||
if(in_array($term_def["location"], ["all", "title"])) {
|
||||
// FUTURE: We may be able to optimise this further by using preg_match_all + preg_quote instead of mb_stripos_all. Experimentation / benchmarking is required to figure out which one is faster
|
||||
$title_matches = mb_stripos_all($lit_title, $term_def["term"]);
|
||||
$title_matches_count = $title_matches !== false ? count($title_matches) : 0;
|
||||
|
@ -1217,7 +1219,7 @@ class search
|
|||
if($lit_tags == null)
|
||||
continue;
|
||||
|
||||
if(!in_array($term_def["location"], ["all", "intags"]))
|
||||
if(!in_array($term_def["location"], ["all", "tags"]))
|
||||
continue; // If we shouldn't search the tags, no point in continuing
|
||||
|
||||
// Consider matches in the page's tags
|
||||
|
|
Loading…
Reference in a new issue