[Fusionforge-commits] r14547 - in branches/Branch_5_1: . src/common/search

Roland Mas lolando at fusionforge.org
Wed Oct 5 17:40:50 CEST 2011


Author: lolando
Date: 2011-10-05 17:40:50 +0200 (Wed, 05 Oct 2011)
New Revision: 14547

Modified:
   branches/Branch_5_1/
   branches/Branch_5_1/src/common/search/SearchQuery.class.php
Log:
Fixed functions creating search filters

Modified: branches/Branch_5_1/src/common/search/SearchQuery.class.php
===================================================================
--- branches/Branch_5_1/src/common/search/SearchQuery.class.php	2011-10-05 15:40:41 UTC (rev 14546)
+++ branches/Branch_5_1/src/common/search/SearchQuery.class.php	2011-10-05 15:40:50 UTC (rev 14547)
@@ -198,26 +198,30 @@
 	}
 
 	function addMatchCondition($qpa, $fieldName) {
-		if(!count($arr)) {
+		if(!count($this->phrases)) {
 			$qpa = db_construct_qpa ($qpa, 'TRUE') ;
-		} else {
-			$regexs = str_replace(' ', "\\\s+", $arr);
-			for ($i = 0; $i < count ($regexs); $i++) {
-				if ($i > 0) {
-					$qpa = db_construct_qpa ($qpa,
-								 $this->operator) ;
-				}
+			return $qpa;
+		}
+
+		$regexs = array_map ('strtolower',
+				     array_merge ($this->phrases,
+						  str_replace(' ', "\s+", $this->phrases)));
+	
+		for ($i = 0; $i < count ($regexs); $i++) {
+			if ($i > 0) {
 				$qpa = db_construct_qpa ($qpa,
-							 $fieldName.' ~* $1',
+							 $this->operator) ;
+			}
+			$qpa = db_construct_qpa ($qpa,
+						 $fieldName.' ~* $1',
 							 array ($regexs[$i])) ;
-			}
 		}
 		return $qpa;
 	}
 
 	function addIlikeCondition($qpa, $fieldName) {
 		$wordArgs = array_map ('strtolower',
-				       array_merge($this->words, str_replace(' ', "\\\s+", $this->phrases)));
+				       array_merge($this->words, $this->phrases));
 
 		for ($i = 0; $i < count ($wordArgs); $i++) {
 			if ($i > 0) {




More information about the Fusionforge-commits mailing list