From c66f16a3e1edb46da1d29b306c718b775439f5d5 Mon Sep 17 00:00:00 2001 From: Michael Hamann Date: Sat, 23 Apr 2011 00:03:00 +0200 Subject: Make the page lookup by title case insensitive again The page lookup by title has been case insensitive before the indexer rewrite, since then it has been case sensitive, this makes it case insensitive again. --- inc/fulltext.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'inc') diff --git a/inc/fulltext.php b/inc/fulltext.php index d2fbabe77..fe398feae 100644 --- a/inc/fulltext.php +++ b/inc/fulltext.php @@ -234,8 +234,7 @@ function _ft_pageLookup(&$data){ } } if ($in_title) { - $wildcard_id = "*$id*"; - foreach ($Indexer->lookupKey('title', $wildcard_id) as $p_id) { + foreach ($Indexer->lookupKey('title', $id, '_ft_pageLookupTitleCompare') as $p_id) { if (!isset($pages[$p_id])) $pages[$p_id] = p_get_first_heading($p_id, false); } @@ -264,6 +263,15 @@ function _ft_pageLookup(&$data){ return $pages; } +/** + * Tiny helper function for comparing the searched title with the title + * from the search index. This function is a wrapper around stripos with + * adapted argument order and return value. + */ +function _ft_pageLookupTitleCompare($search, $title) { + return stripos($title, $search) !== false; +} + /** * Sort pages based on their namespace level first, then on their string * values. This makes higher hierarchy pages rank higher than lower hierarchy -- cgit v1.2.3