summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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.