From 248a73214063d2fe47787c8c4aa292777cddb12b Mon Sep 17 00:00:00 2001 From: matthiasgrimm Date: Sat, 4 Jun 2005 23:20:26 +0200 Subject: extended search fix This patch fixes a bug in the search code and did some optimizations. Furtheron queries with only excluded words will be rejected because they won't produce usable output and waste only time. darcs-hash:20050604212026-7ef76-7a096791875407859eae390290165e4b6e7ef082.gz --- inc/search.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'inc/search.php') diff --git a/inc/search.php b/inc/search.php index 654f1ab69..b96f2444d 100644 --- a/inc/search.php +++ b/inc/search.php @@ -317,6 +317,9 @@ function search_fulltext(&$data,$base,$file,$type,$lvl,$opts){ break; } } + + // a search without any posword is useless + if (!count($poswords)) return true; $req = count($poswords) ? $reg .= '^(?=.*?'.join(')(?=.*?',$poswords).')' : '^'; $reg .= count($negwords) ? '((?!'.join('|',$negwords).').)*$' : '.*$'; -- cgit v1.2.3