Permalink
Browse files

Support search in title as well

  • Loading branch information...
1 parent 4b55ed0 commit 417a675c711243921fced67336d6d5b338826ff6 @adrianheine adrianheine committed Jun 16, 2010
Showing with 6 additions and 12 deletions.
  1. +6 −12 action.php
View
@@ -125,9 +125,9 @@ function _handle_ajax($event) {
require_once(DOKU_INC.'inc/fulltext.php');
$search = cleanID($_POST['search']);
- $pages = ft_pageLookup($search, false);
+ $pages = ft_pageLookup($search, false, false);
$result = array();
- foreach ($pages as $page) {
+ foreach ($pages as $page => $title) {
if (($aliases[$type]['prefix'] !== '' &&
stripos($page, $aliases[$type]['prefix']) !== 0) ||
($aliases[$type]['postfix'] !== '' &&
@@ -145,25 +145,19 @@ function _handle_ajax($event) {
$id = substr($page, strlen($aliases[$type]['prefix']), $rtrim);
}
- if (useHeading('content')) {
- $heading = p_get_first_heading($page,true);
- } else {
- $heading = '';
- }
-
if ($search !== '' &&
(stripos($id, $search) === false &&
- stripos($heading, $search) === false) ||
+ stripos($title, $search) === false) ||
strpos($id, ':') !== false) {
continue;
}
$id = utf8_ucwords(str_replace('_', ' ', $id));
- if ($heading === '') {
- $heading = $id;
+ if ($title === '') {
+ $title = $id;
}
- $result[hsc($id)] = hsc($heading);
+ $result[hsc($id)] = hsc($title);
}
require_once DOKU_INC . 'inc/JSON.php';

0 comments on commit 417a675

Please sign in to comment.