Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix(search): don't truncate namespaces with - and . in pagename-lookup
The regex for the pagename lookup didn't account for `-` and `.` being
valid characters for namespaces, which lead to wrong results in the
quicksearch and pagename lookup. The full search, which already used the
queryParser, showed the correct results.

This fixes #1659
  • Loading branch information
micgro42 committed Mar 26, 2018
1 parent b3cfe85 commit 940f24f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions inc/fulltext.php
Expand Up @@ -233,9 +233,11 @@ function ft_pageLookup($id, $in_ns=false, $in_title=false){
function _ft_pageLookup(&$data){
// split out original parameters
$id = $data['id'];
if (preg_match('/(?:^| )(?:@|ns:)([\w:]+)/', $id, $matches)) {
$ns = cleanID($matches[1]) . ':';
$id = str_replace($matches[0], '', $id);
$Indexer = idx_get_indexer();
$parsedQuery = ft_queryParser($Indexer, $id);
if (count($parsedQuery['ns']) > 0) {
$ns = cleanID($parsedQuery['ns'][0]) . ':';
$id = implode(' ', $parsedQuery['highlight']);
}

$in_ns = $data['in_ns'];
Expand Down

0 comments on commit 940f24f

Please sign in to comment.