@@ -483,28 +483,10 @@ public function compileWhere()
483483 }
484484
485485 if (!empty ($ this ->where )) {
486- $ just_opened = false ;
487-
488486 foreach ($ this ->where as $ key => $ where ) {
489- if (in_array ($ where ['ext_operator ' ], array ('AND ( ' , 'OR ( ' , ') ' ))) {
490- // if match is not empty we've got to use an operator
491- if ($ key == 0 || ! empty ($ this ->match )) {
492- $ query .= '( ' ;
493-
494- $ just_opened = true ;
495- } else {
496- $ query .= $ where ['ext_operator ' ].' ' ;
497- }
498-
499- continue ;
487+ if ($ key > 0 || !empty ($ this ->match )) {
488+ $ query .= 'AND ' ;
500489 }
501-
502- if ($ key > 0 && !$ just_opened || !empty ($ this ->match )) {
503- $ query .= $ where ['ext_operator ' ].' ' ; // AND/OR
504- }
505-
506- $ just_opened = false ;
507-
508490 $ query .= $ this ->compileFilterCondition ($ where );
509491 }
510492 }
@@ -949,19 +931,17 @@ public function match($column, $value = null, $half = false)
949931 * @param string $column The column name
950932 * @param string $operator The operator to use
951933 * @param string $value The value to check against
952- * @param boolean $or If it should be prepended with OR (true) or AND (false) - not available as for Sphinx 2.0.2
953934 *
954935 * @return SphinxQL
955936 */
956- public function where ($ column , $ operator , $ value = null , $ or = false )
937+ public function where ($ column , $ operator , $ value = null )
957938 {
958939 if ($ value === null ) {
959940 $ value = $ operator ;
960941 $ operator = '= ' ;
961942 }
962943
963944 $ this ->where [] = array (
964- 'ext_operator ' => $ or ? 'OR ' : 'AND ' ,
965945 'column ' => $ column ,
966946 'operator ' => $ operator ,
967947 'value ' => $ value
@@ -970,58 +950,6 @@ public function where($column, $operator, $value = null, $or = false)
970950 return $ this ;
971951 }
972952
973- /**
974- * OR WHERE - at this time (Sphinx 2.0.2) it's not available
975- *
976- * @param string $column The column name
977- * @param string $operator The operator to use
978- * @param mixed $value The value to compare against
979- *
980- * @return SphinxQL
981- */
982- public function orWhere ($ column , $ operator , $ value = null )
983- {
984- $ this ->where ($ column , $ operator , $ value , true );
985-
986- return $ this ;
987- }
988-
989- /**
990- * Opens a parenthesis prepended with AND (where necessary)
991- *
992- * @return SphinxQL
993- */
994- public function whereOpen ()
995- {
996- $ this ->where [] = array ('ext_operator ' => 'AND ( ' );
997-
998- return $ this ;
999- }
1000-
1001- /**
1002- * Opens a parenthesis prepended with OR (where necessary)
1003- *
1004- * @return SphinxQL
1005- */
1006- public function orWhereOpen ()
1007- {
1008- $ this ->where [] = array ('ext_operator ' => 'OR ( ' );
1009-
1010- return $ this ;
1011- }
1012-
1013- /**
1014- * Closes a parenthesis in WHERE
1015- *
1016- * @return SphinxQL
1017- */
1018- public function whereClose ()
1019- {
1020- $ this ->where [] = array ('ext_operator ' => ') ' );
1021-
1022- return $ this ;
1023- }
1024-
1025953 /**
1026954 * GROUP BY clause
1027955 * Adds to the previously added columns
0 commit comments