Index: trunk/kernel/include/advsearch.php =================================================================== diff -u -r35 -r80 --- trunk/kernel/include/advsearch.php (.../advsearch.php) (revision 35) +++ trunk/kernel/include/advsearch.php (.../advsearch.php) (revision 80) @@ -116,6 +116,7 @@ $FieldItem["weight"] = $FieldConfig->Get("Priority"); } $this->FieldList[] = $FieldItem; + unset($FieldItem); } } @@ -126,9 +127,10 @@ { $where = ""; foreach($this->FieldList as $f) - { $where .= " (".$f["where"].") ".$f["conjuction"]; - } + + $cut_length = substr($where, -2) == 'OR' ? 2 : substr($where, -3) == 'AND' ? 3 : 0; + $where = substr($where, 0, strlen($where) - $cut_length); return $where; } @@ -156,12 +158,14 @@ { $SelectSQL .= " WHERE ".$WhereClause; } - $SelectSQL .= "GROUP BY $idField "; + $SelectSQL .= " GROUP BY $idField "; $this->adodbConnection->Execute("DROP TABLE ".$this->ResultTable); $full_sql = "CREATE TABLE ".$this->ResultTable." ".$indexSQL.$SelectSQL; $this->adodbConnection->Execute($full_sql); - //echo "
$full_sql"; + // if advanced seaech used, then delete simple search keywords + $objSession->SetVariable('Search_Keywords', ''); + //print_pre($full_sql); } function BuildIndexes() Index: trunk/kernel/include/parseditem.php =================================================================== diff -u -r29 -r80 --- trunk/kernel/include/parseditem.php (.../parseditem.php) (revision 29) +++ trunk/kernel/include/parseditem.php (.../parseditem.php) (revision 80) @@ -2695,11 +2695,13 @@ function LoadSearchItems($attribs = array()) { global $CountVal, $objSession; - + //echo "Loading ".get_class($this)." Search Items
"; print_r($objSearchCats->Items); echo ""; foreach($objSearchCats->Items as $cat) { - $cat->Keywords = GetKeywords($objSession->GetVariable("Search_Keywords")); - $keywords = $objSession->GetVariable("Search_Keywords"); - - //echo "
"; print_r($objSession->GetVariable("Search_Keywords")); echo ""; - //echo $_POST['keywords']."
"; print_r($objSearchCats->Items); echo ""; + //echo "
"; print_r($objSearchCats->Items); echo ""; $ret = 0; - $keywords = $objSession->GetVariable("Search_Keywords"); + $keywords = $objSession->GetVariable("Search_Keywords"); if ($keywords) { foreach ($objSearchCats->Items as $cat) { Index: trunk/kernel/include/searchconfig.php =================================================================== diff -u -r13 -r80 --- trunk/kernel/include/searchconfig.php (.../searchconfig.php) (revision 13) +++ trunk/kernel/include/searchconfig.php (.../searchconfig.php) (revision 80) @@ -59,15 +59,15 @@ $where = str_replace("{Value}",$value,$this->Get("IsWhere")); } else - $where = $field." = ".$value; + $where = $field." = '".$value."'"; break; case "isnot": if(strlen($this->Get("IsNotWhere"))) { $where = str_replace("{Value}",$value,$this->Get("IsNotWhere")); } else - $where = $field." != ".$value; + $where = $field." != '".$value."'"; break; case "contains": if(strlen($this->Get("ContainsWhere"))) @@ -204,13 +204,12 @@ case "andor_radio": $name = $this->Get("FieldName"); $Field = "andor[$name]"; - if($FormValues[$Field]=="1") - $checked=" checked"; - $ret = "".language("lu_and"); - $checked = ""; - if($FormValues[$Field]=="2") - $checked=" checked"; - $ret .= "".language("lu_or"); + $checked = Array(1 => '', 2 => ''); + $checked[ $FormValues[$Field] ] = ' checked'; + if(!$FormValues[$Field]) $checked[1] = ' checked'; + print_pre($checked); + $ret = "".language("lu_and"); + $ret .= "".language("lu_or"); return $ret; } Index: trunk/kernel/frontaction.php =================================================================== diff -u -r35 -r80 --- trunk/kernel/frontaction.php (.../frontaction.php) (revision 35) +++ trunk/kernel/frontaction.php (.../frontaction.php) (revision 80) @@ -750,6 +750,7 @@ switch($_GET["type"]) { case 1: /* category */ + //echo "Searching for categories