| 
					
				 | 
			
			
				@@ -122,6 +122,7 @@ function tripal_do_search($keywords, $type, $join1 = '', $where1 = '1 = 1', $arg 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   // Calculate maximum keyword relevance, to normalize it. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  // @coder-ignore: can't use placeholders since variable defines a join 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   $select = "SELECT SUM(i.score * t.count) AS score FROM {search_index} i " . $join . " WHERE $conditions GROUP BY i.type, i.sid HAVING COUNT(*) >= %d ORDER BY score DESC"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   $arguments = array_merge($arguments1, array($query[4])); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   $normalize = db_result(db_query_range($select, $arguments, 0, 1)); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -131,6 +132,7 @@ function tripal_do_search($keywords, $type, $join1 = '', $where1 = '1 = 1', $arg 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   $columns2 = str_replace('i.relevance', '('. (1.0 / $normalize) .' * SUM(i.score * t.count))', $columns2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   // Build query to retrieve results. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  // @coder-ignore: can't use placeholders since variable defines a join 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   $select = "SELECT i.type, i.sid, $columns2 FROM {search_index} i " . $join . " " . $join2 . " WHERE $conditions GROUP BY i.type, i.sid HAVING COUNT(*) >= %d"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   $count_select =  "SELECT COUNT(*) FROM ($select) n1"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   $arguments = array_merge($arguments2, $arguments1, array($query[4])); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -144,3 +146,14 @@ function tripal_do_search($keywords, $type, $join1 = '', $where1 = '1 = 1', $arg 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   return $results; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * Implements hook_coder_ignore(). 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * Defines the path to the file (tripal_search.coder_ignores.txt) where ignore rules for coder are stored 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+function tripal_search_coder_ignore() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  return array( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    'path' => drupal_get_path('module', 'tripal_search'), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    'line prefix' => drupal_get_path('module', 'tripal_search'), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 |