Skip to content
Snippets Groups Projects
Commit d0bdf765 authored by Adrian Lang's avatar Adrian Lang
Browse files

Use namespace filter in quicksearch with empty search term

parent 003a37b4
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment