From 506fa8936561993b7f70aa507d0c39a44a6ebab9 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Sun, 4 Sep 2005 00:02:29 +0200 Subject: the search now uses the index darcs-hash:20050903220229-7ad00-5d95f905eaeb3f6b867aa3ee43c2a8bccc533c00.gz --- inc/html.php | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'inc/html.php') diff --git a/inc/html.php b/inc/html.php index dcd11feb1..b73eebf8c 100644 --- a/inc/html.php +++ b/inc/html.php @@ -295,6 +295,7 @@ function html_hilight($html,$query){ */ function html_search(){ require_once(DOKU_INC.'inc/search.php'); + require_once(DOKU_INC.'inc/fulltext.php'); global $conf; global $QUERY; global $ID; @@ -312,14 +313,14 @@ function html_search(){ //do quick pagesearch $data = array(); - search($data,$conf['datadir'],'search_pagename',array(query => cleanID($QUERY))); + $data = ft_pageLookup(cleanID($QUERY)); if(count($data)){ sort($data); print '
'; print ''.$lang[quickhits].':
'; - foreach($data as $row){ + foreach($data as $id){ print '
'; - print html_wikilink(':'.$row['id'],$conf['useheading']?NULL:$row['id']); + print html_wikilink(':'.$id,$conf['useheading']?NULL:$id); print '
'; } //clear float (see http://www.complexspiral.com/publications/containing-floats/) @@ -329,16 +330,19 @@ function html_search(){ flush(); //do fulltext search - $data = array(); - search($data,$conf['datadir'],'search_fulltext',array(query => utf8_strtolower($QUERY))); + $data = ft_pageSearch($QUERY,$poswords); if(count($data)){ - usort($data,'sort_search_fulltext'); - foreach($data as $row){ + $num = 1; + foreach($data as $id => $cnt){ print '
'; - print html_wikilink(':'.$row['id'],$conf['useheading']?NULL:$row['id'],$row['poswords']); - print ': '.$row['count'].' '.$lang['hits'].'
'; - print '
'.$row['snippet'].'
'; + print html_wikilink(':'.$id,$conf['useheading']?NULL:$id,$poswords); + print ': '.$cnt.' '.$lang['hits'].'
'; + if($num < 15){ // create snippets for the first number of matches only #FIXME add to conf ? + print '
'.ft_snippet($id,$poswords).'
'; + } print '
'; + flush(); + $num++; } }else{ print '
'.$lang['nothingfound'].'
'; -- cgit v1.2.3