summaryrefslogtreecommitdiff
path: root/inc
diff options
context:
space:
mode:
authorAdrian Lang <lang@cosmocode.de>2010-08-20 18:53:48 +0200
committerAdrian Lang <lang@cosmocode.de>2010-08-20 18:54:52 +0200
commitd0bdf7659fce98c2922b151766d51d5c7e8814d6 (patch)
tree24bf39556ae05b1a8d6317de25d99dac05311900 /inc
parent003a37b419108048f084be9c59598a00a7eb8724 (diff)
downloadrpg-d0bdf7659fce98c2922b151766d51d5c7e8814d6.tar.gz
rpg-d0bdf7659fce98c2922b151766d51d5c7e8814d6.tar.bz2
Use namespace filter in quicksearch with empty search term
Diffstat (limited to 'inc')
-rw-r--r--inc/fulltext.php18
1 files changed, 11 insertions, 7 deletions
diff --git a/inc/fulltext.php b/inc/fulltext.php
index 1c9981812..cac2de4a4 100644
--- a/inc/fulltext.php
+++ b/inc/fulltext.php
@@ -243,17 +243,21 @@ function _ft_pageLookup(&$data){
$titles = array_map('rtrim', idx_getIndex('title', ''));
$pages = array_combine($pages, $titles);
- if($id !== '' && cleanID($id) !== '') {
+ if ($id !== '' && cleanID($id) !== '') {
$cleaned = cleanID($id);
- $matched_pages = array();
foreach ($pages as $p_id => $p_title) {
- if (((strpos($in_ns ? $p_id : noNSorNS($p_id), $cleaned) !== false) ||
- ($in_title && stripos($p_title, $id) !== false)) &&
- (!isset($ns) || strpos($p_id, $ns) === 0)) {
- $matched_pages[$p_id] = $p_title;
+ if ((strpos($in_ns ? $p_id : noNSorNS($p_id), $cleaned) === false) &&
+ ($in_title && stripos($p_title, $id) === false)) {
+ unset($pages[$p_id]);
+ }
+ }
+ }
+ if (isset($ns)) {
+ foreach (array_keys($pages) as $p_id) {
+ if (strpos($p_id, $ns) !== 0) {
+ unset($pages[$p_id]);
}
}
- $pages = $matched_pages;
}
// discard hidden pages