Index: trunk/kernel/include/advsearch.php
===================================================================
diff -u -r4084 -r4231
--- trunk/kernel/include/advsearch.php (.../advsearch.php) (revision 4084)
+++ trunk/kernel/include/advsearch.php (.../advsearch.php) (revision 4231)
@@ -17,6 +17,8 @@
var $PctPop;
var $PctRating;
+ var $SearchLogRecord = Array();
+
function clsAdvancedSearchResults($SearchSource,$DataClass, $ItemType = 0)
{
global $objConfig, $objSearchConfig;
@@ -95,6 +97,8 @@
static $x = 0, $customs_joined = Array();
+// echo 'Adding ADVANCED SearchField: ['.$TableName.']; ['.$FieldName.']; ['.$Verb.']; ['.$Value.']; ['.$conj.']
';
+
if(!is_object($objSearchConfig))
$objSearchConfig = new clsSeachConfigList();
@@ -127,12 +131,10 @@
$this->AddRelationship($Table.' AS '.$pseudo, $join);
// for items that does not have appropriate records in CustomMetaData table
- if ($Verb == 'notcontains' || $Verb == 'isnot')
- {
+ if ($Verb == 'notcontains' || $Verb == 'isnot') {
$or_not_null = ' OR '.$pseudo.'.'.$Field.' IS NULL';
}
- else
- {
+ else {
$or_not_null = '';
}
@@ -142,8 +144,7 @@
$FieldItem["conjuction"] = $conj;
$FieldItem["weight"] = $FieldConfig->Get("Priority");
}
- else
- {
+ else {
$classes = Array( 'Link' => '_clsLinkList',
'News' => '_clsNewsList',
'Topic' => '_clsTopicList',
@@ -158,8 +159,7 @@
$FieldConfig->Set('FieldName', $ml_formatter->LangFieldName('cust_'.$FieldConfig->Get('CustomFieldId')));
}
- switch ($FieldName)
- {
+ switch ($FieldName) {
case 'HotItem':
$cutoff = $objList->GetHotValue();
$Value == 1 ? $not = '' : $not = 'NOT ';
@@ -214,11 +214,19 @@
}
$this->FieldList[] = $FieldItem;
+
+ // create search record
+ $this->SearchLogRecord[] = language('la_Field').' "'.$FieldConfig->getHumanField().'" '.$FieldConfig->getHumanVerb($Verb).' '.language('la_Value').' "'.$FieldConfig->getHumanValue($Value).'" '.language('lu_'.$conj);
+
unset($FieldItem);
}
-
+ function getKeywords(&$FieldConfig)
+ {
+ $ret = implode('
', $this->SearchLogRecord);
+ return preg_replace('/(.*) '.preg_quote(language('lu_and'), '/').'|'.preg_quote(language('lu_or'), '/').'$/is', '\\1', $ret);
+ }
/* function AddAdvancedCustomFields()
{
@@ -284,6 +292,10 @@
static $SelectSQL, $OldItemType;
global $objSession, $objItemTypes;
+ // add recrod to log
+ $objSearchList = new clsSearchLogList();
+ $objSearchList->UpdateKeyword($this->getKeywords(), 1);
+
$ctype = $objItemTypes->GetItem($ItemType);
$idField = $ctype->Get("SourceTable")."Id";
$this->SourceTable = AddTablePrefix($ctype->Get("SourceTable"));