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

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


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

Modified:
   branches/Branch_5_1/
   branches/Branch_5_1/src/common/search/SearchQuery.class.php
Log:
Fixed phrase detection in search query parser

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:32 UTC (rev 14545)
+++ branches/Branch_5_1/src/common/search/SearchQuery.class.php	2011-10-05 15:40:41 UTC (rev 14546)
@@ -136,8 +136,8 @@
 			$inQuote = false;
 			foreach(explode(' ', quotemeta($words)) as $word) {
 				if($inQuote) {
-					if(substr($word, -3) == "\\\\'") {
-						$word = substr($word, 0, -3);
+					if(substr($word, -1) == "'") {
+						$word = substr($word, 0, -1);
 						$inQuote = false;
 						$phrase .= ' '.$word;
 						$this->phrases[] = $phrase;
@@ -145,14 +145,14 @@
 						$phrase .= ' '.$word;
 					}
 				} else {
-					if(substr($word, 0, 3) == "\\\\'") {
-						$word = substr($word, 3);
+					if(substr($word, 0, 1) == "'") {
+						$word = substr($word, 1);
 						$inQuote = true;
-						if(substr($word, -3) == "\\\\'") {
+						if(substr($word, -1) == "'") {
 							// This is a special case where the phrase is just one word
-							$word = substr($word, 0, -3);
+							$word = substr($word, 0, -1);
 							$inQuote = false;
-							$this->phrases[] = $word;
+							$this->words[] = $word;
 						} else {
 							$phrase = $word;
 						}




More information about the Fusionforge-commits mailing list