From 940f24fc89392ebb37bf46b27eb0adbd74962112 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9Fe?= <grosse@cosmocode.de> Date: Mon, 26 Mar 2018 12:02:29 +0200 Subject: [PATCH] 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 --- inc/fulltext.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/inc/fulltext.php b/inc/fulltext.php index b47999a51..9034d229b 100644 --- a/inc/fulltext.php +++ b/inc/fulltext.php @@ -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']; -- GitLab