| @@ -42,6 +42,7 @@ class SearchView | |||||
| var $mid; | var $mid; | ||||
| var $KType; | var $KType; | ||||
| var $Keyword; | var $Keyword; | ||||
| var $SearchKeyword; | |||||
| var $SearchMax; | var $SearchMax; | ||||
| var $SearchMaxRc; | var $SearchMaxRc; | ||||
| var $SearchTime; | var $SearchTime; | ||||
| @@ -98,6 +99,7 @@ class SearchView | |||||
| $this->dtp2->SetNameSpace("field", "[", "]"); | $this->dtp2->SetNameSpace("field", "[", "]"); | ||||
| $this->TypeLink = new TypeLink($typeid); | $this->TypeLink = new TypeLink($typeid); | ||||
| //通过分词获取关键词 | //通过分词获取关键词 | ||||
| $this->SearchKeyword = $keyword; | |||||
| $this->Keywords = $this->GetKeywords($keyword); | $this->Keywords = $this->GetKeywords($keyword); | ||||
| //设置一些全局参数的值 | //设置一些全局参数的值 | ||||
| if ($this->TypeID == "0") { | if ($this->TypeID == "0") { | ||||
| @@ -298,26 +300,14 @@ class SearchView | |||||
| */ | */ | ||||
| function GetRedKeyWord($fstr) | function GetRedKeyWord($fstr) | ||||
| { | { | ||||
| $ks = explode(' ', $this->Keywords); | |||||
| foreach ($ks as $k) { | |||||
| $k = trim($k); | |||||
| if ($k == '') { | |||||
| continue; | |||||
| } | |||||
| if (ord($k[0]) > 0x80 && strlen($k) < 2) { | |||||
| continue; | |||||
| } | |||||
| //不区分大小$fstr = str_ireplace($k, "<strong style='color:red'>$k</strong>", $fstr); | |||||
| //速度效率更快 | |||||
| $fstr = str_replace($k, "<strong style='color:red'>$k</strong>", $fstr); | |||||
| } | |||||
| return $fstr; | |||||
| $k = trim($this->SearchKeyword); | |||||
| return ($k == '')? $fstr : str_replace($k, "<strong style='color:red'>$k</strong>", $fstr); | |||||
| } | } | ||||
| /** | /** | ||||
| * 统计列表里的记录 | * 统计列表里的记录 | ||||
| * | * | ||||
| * @access public | * @access public | ||||
| * @return string | |||||
| * @return void | |||||
| */ | */ | ||||
| function CountRecord() | function CountRecord() | ||||
| { | { | ||||