Fixed PHP warning with empty search results
authorDan Fuhry <dan@enanocms.org>
Sun, 08 Aug 2010 17:18:00 -0400
changeset 1289 541bb25d0b22
parent 1288 bf59bcc79baf
child 1290 27ab1b13a783
Fixed PHP warning with empty search results
includes/search.php
--- a/includes/search.php	Tue Aug 03 22:10:07 2010 -0400
+++ b/includes/search.php	Sun Aug 08 17:18:00 2010 -0400
@@ -549,7 +549,8 @@
 
 	// Divisor for calculating relevance scores
 	$divisor = ( count($query['any']) + count($query_phrase['any']) + count($query['req']) + count($query['not']) ) * 1.5;
-	$divisor = max($divisor, max($scores));
+	$divisor = max($divisor,
+				count($scores) > 0 ? max($scores) : 0);
 	
 	foreach ( $scores as $page_id => $score )
 	{