includes/search.php
changeset 1289 541bb25d0b22
parent 1228 9e9334417dbc
child 1367 c660cf54c045
equal deleted inserted replaced
1288:bf59bcc79baf 1289:541bb25d0b22
   547 	// Sort scores array
   547 	// Sort scores array
   548 	arsort($scores);
   548 	arsort($scores);
   549 
   549 
   550 	// Divisor for calculating relevance scores
   550 	// Divisor for calculating relevance scores
   551 	$divisor = ( count($query['any']) + count($query_phrase['any']) + count($query['req']) + count($query['not']) ) * 1.5;
   551 	$divisor = ( count($query['any']) + count($query_phrase['any']) + count($query['req']) + count($query['not']) ) * 1.5;
   552 	$divisor = max($divisor, max($scores));
   552 	$divisor = max($divisor,
       
   553 				count($scores) > 0 ? max($scores) : 0);
   553 	
   554 	
   554 	foreach ( $scores as $page_id => $score )
   555 	foreach ( $scores as $page_id => $score )
   555 	{
   556 	{
   556 		if ( !isset($page_data[$page_id]) )
   557 		if ( !isset($page_data[$page_id]) )
   557 			// It's possible that $scores contains a score for a page that was later eliminated because it contained a disallowed term
   558 			// It's possible that $scores contains a score for a page that was later eliminated because it contained a disallowed term