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()