From a9bdf9fde29c5bf71d3a402fc15806ca8923aea8 Mon Sep 17 00:00:00 2001 From: xue <> Date: Fri, 4 Aug 2006 15:40:44 +0000 Subject: Fixed #320. --- demos/quickstart/protected/pages/Search.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'demos/quickstart') diff --git a/demos/quickstart/protected/pages/Search.php b/demos/quickstart/protected/pages/Search.php index f1d07ffa..d2dfa7da 100644 --- a/demos/quickstart/protected/pages/Search.php +++ b/demos/quickstart/protected/pages/Search.php @@ -13,11 +13,11 @@ class Search extends TPage $hits_1 = $quickstart->find($text); $this->quickstart_results->setDataSource($hits_1); $this->quickstart_results->dataBind(); - + $this->emptyResult->setVisible(!count($hits_1)); } } - + public function highlightSearch($text) { $words = str_word_count($text, 1); @@ -33,7 +33,7 @@ class Search extends TPage break; } } - + $min = $where - 15 < 0 ? 0 : $where - 15; $max = $where + 15 > $t ? $t : $where + 15; $subtext = array_splice($words, $min, $max-$min); @@ -41,13 +41,13 @@ class Search extends TPage $suffix = $max == $t ? '' : '...'; return $prefix.implode(' ', $subtext).$suffix; } - + protected function containsKeys($word, $keys) { foreach($keys as $key) { if(is_int(strpos($word, $key))) - return true; + return true; } return false; } -- cgit v1.2.3