diff options
author | Kazutaka Miyasaka <kazmiya@gmail.com> | 2009-09-20 14:11:16 +0200 |
---|---|---|
committer | Kazutaka Miyasaka <kazmiya@gmail.com> | 2009-09-20 14:11:16 +0200 |
commit | 865c268791a99fa57aa818528c6f2473b26d954f (patch) | |
tree | c0ce7e9a19513a8aa613e1b2a8c762b45f33c21e /inc/html.php | |
parent | a3cecc7a9764a1c21507c5fb130c637b3669da15 (diff) | |
download | rpg-865c268791a99fa57aa818528c6f2473b26d954f.tar.gz rpg-865c268791a99fa57aa818528c6f2473b26d954f.tar.bz2 |
enhanced full-text search function
Ignore-this: cb05f50ca4de12e1cdf3a6cfb0e1b8bc
- better search experience in Asian language
- sophisticated search query syntax (OR, grouping, etc.)
darcs-hash:20090920121116-9b77a-2718be7a043374669037b10d94101fc70efb95e3.gz
Diffstat (limited to 'inc/html.php')
-rw-r--r-- | inc/html.php | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/inc/html.php b/inc/html.php index b0cffe887..9581a27e7 100644 --- a/inc/html.php +++ b/inc/html.php @@ -305,11 +305,6 @@ function html_search(){ //check if search is restricted to namespace if(preg_match('/@([^@]*)/',$QUERY,$match)) { $id = cleanID($match[1]); - if(empty($id)) { - print '<div class="nothing">'.$lang['nothingfound'].'</div>'; - flush(); - return; - } } else { $id = cleanID($QUERY); } @@ -325,7 +320,7 @@ function html_search(){ //do quick pagesearch $data = array(); - $data = ft_pageLookup($id); + if($id) $data = ft_pageLookup($id); if(count($data)){ print '<div class="search_quickresult">'; print '<h3>'.$lang['quickhits'].':</h3>'; @@ -355,13 +350,15 @@ function html_search(){ foreach($data as $id => $cnt){ print '<div class="search_result">'; print html_wikilink(':'.$id,useHeading('navigation')?NULL:$id,$regex); - print ': <span class="search_cnt">'.$cnt.' '.$lang['hits'].'</span><br />'; - if($num < 15){ // create snippets for the first number of matches only #FIXME add to conf ? - print '<div class="search_snippet">'.ft_snippet($id,$regex).'</div>'; + if($cnt !== 0){ + print ': <span class="search_cnt">'.$cnt.' '.$lang['hits'].'</span><br />'; + if($num < 15){ // create snippets for the first number of matches only #FIXME add to conf ? + print '<div class="search_snippet">'.ft_snippet($id,$regex).'</div>'; + } + $num++; } print '</div>'; flush(); - $num++; } }else{ print '<div class="nothing">'.$lang['nothingfound'].'</div>'; |