summaryrefslogtreecommitdiff
path: root/inc
diff options
context:
space:
mode:
authorMichael Hamann <michael@content-space.de>2011-04-23 00:03:00 +0200
committerMichael Hamann <michael@content-space.de>2011-04-23 00:04:37 +0200
commitc66f16a3e1edb46da1d29b306c718b775439f5d5 (patch)
treebad7a2da1807f5a0d2203d0cec286efa35684969 /inc
parentc991623aeaf83a155d3332a49c61b153d9d7bca2 (diff)
downloadrpg-c66f16a3e1edb46da1d29b306c718b775439f5d5.tar.gz
rpg-c66f16a3e1edb46da1d29b306c718b775439f5d5.tar.bz2
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.
Diffstat (limited to 'inc')
-rw-r--r--inc/fulltext.php12
1 files changed, 10 insertions, 2 deletions
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);
}
@@ -265,6 +264,15 @@ function _ft_pageLookup(&$data){
}
/**
+ * 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
* pages.