original_string: public function Index($Page = '') {
  		$this->AddJsFile('search.js');
  		$this->Title(T('Search'));
        
        SaveToConfig('Garden.Format.EmbedSize', '160x90', FALSE);
        Gdn_Theme::Section('SearchResults');
        
        list($Offset, $Limit) = OffsetLimit($Page, C('Garden.Search.PerPage', 20));
        $this->SetData('_Limit', $Limit);
  		
  		$Search = $this->Form->GetFormValue('Search');
        $Mode = $this->Form->GetFormValue('Mode');
        if ($Mode)
           $this->SearchModel->ForceSearchMode = $Mode;
        try {
           $ResultSet = $this->SearchModel->Search($Search, $Offset, $Limit);
        } catch (Gdn_UserException $Ex) {
           $this->Form->AddError($Ex);
           $ResultSet = array();
        } catch (Exception $Ex) {
           LogException($Ex);
           $this->Form->AddError($Ex);
           $ResultSet = array();
        }
        Gdn::UserModel()->JoinUsers($ResultSet, array('UserID'));
        
        // Fix up the summaries.
        $SearchTerms = explode(' ', Gdn_Format::Text($Search));
        foreach ($ResultSet as &$Row) {
           $Row['Summary'] = SearchExcerpt(Gdn_Format::PlainText($Row['Summary'], $Row['Format']), $SearchTerms);
           $Row['Format'] = 'Html';
        }
        
  		$this->SetData('SearchResults', $ResultSet, TRUE);
  		$this->SetData('SearchTerm', Gdn_Format::Text($Search), TRUE);
  		if($ResultSet)
  			$NumResults = count($ResultSet);
  		else
  			$NumResults = 0;
  		if ($NumResults == $Offset + $Limit)
  			$NumResults++;
  		
  		// Build a pager
  		$PagerFactory = new Gdn_PagerFactory();
  		$this->Pager = $PagerFactory->GetPager('MorePager', $this);
  		$this->Pager->MoreCode = 'More Results';
  		$this->Pager->LessCode = 'Previous Results';
  		$this->Pager->ClientID = 'Pager';
  		$this->Pager->Configure(
  			$Offset,
  			$Limit,
  			$NumResults,
  			'dashboard/search/%1$s/%2$s/?Search='.Gdn_Format::Url($Search)
  		);
  		
  //		if ($this->_DeliveryType != DELIVERY_TYPE_ALL) {
  //         $this->SetJson('LessRow', $this->Pager->ToString('less'));
  //         $this->SetJson('MoreRow', $this->Pager->ToString('more'));
  //         $this->View = 'results';
  //      }
  		
        $this->CanonicalUrl(Url('search', TRUE));
  
  		$this->Render();
  	}
code: public function Index($Page = '') {
  		$this->AddJsFile('search.js');
  		$this->Title(T('Search'));
        
        SaveToConfig('Garden.Format.EmbedSize', '160x90', FALSE);
        Gdn_Theme::Section('SearchResults');
        
        list($Offset, $Limit) = OffsetLimit($Page, C('Garden.Search.PerPage', 20));
        $this->SetData('_Limit', $Limit);
  		
  		$Search = $this->Form->GetFormValue('Search');
        $Mode = $this->Form->GetFormValue('Mode');
        if ($Mode)
           $this->SearchModel->ForceSearchMode = $Mode;
        try {
           $ResultSet = $this->SearchModel->Search($Search, $Offset, $Limit);
        } catch (Gdn_UserException $Ex) {
           $this->Form->AddError($Ex);
           $ResultSet = array();
        } catch (Exception $Ex) {
           LogException($Ex);
           $this->Form->AddError($Ex);
           $ResultSet = array();
        }
        Gdn::UserModel()->JoinUsers($ResultSet, array('UserID'));
        
        // Fix up the summaries.
        $SearchTerms = explode(' ', Gdn_Format::Text($Search));
        foreach ($ResultSet as &$Row) {
           $Row['Summary'] = SearchExcerpt(Gdn_Format::PlainText($Row['Summary'], $Row['Format']), $SearchTerms);
           $Row['Format'] = 'Html';
        }
        
  		$this->SetData('SearchResults', $ResultSet, TRUE);
  		$this->SetData('SearchTerm', Gdn_Format::Text($Search), TRUE);
  		if($ResultSet)
  			$NumResults = count($ResultSet);
  		else
  			$NumResults = 0;
  		if ($NumResults == $Offset + $Limit)
  			$NumResults++;
  		
  		// Build a pager
  		$PagerFactory = new Gdn_PagerFactory();
  		$this->Pager = $PagerFactory->GetPager('MorePager', $this);
  		$this->Pager->MoreCode = 'More Results';
  		$this->Pager->LessCode = 'Previous Results';
  		$this->Pager->ClientID = 'Pager';
  		$this->Pager->Configure(
  			$Offset,
  			$Limit,
  			$NumResults,
  			'dashboard/search/%1$s/%2$s/?Search='.Gdn_Format::Url($Search)
  		);
  		
  //		if ($this->_DeliveryType != DELIVERY_TYPE_ALL) {
  //         $this->SetJson('LessRow', $this->Pager->ToString('less'));
  //         $this->SetJson('MoreRow', $this->Pager->ToString('more'));
  //         $this->View = 'results';
  //      }
  		
        $this->CanonicalUrl(Url('search', TRUE));
  
  		$this->Render();
  	}
code_tokens: public function Index ( $ Page = '' ) { $ this -> AddJsFile ( 'search.js' ) ; $ this -> Title ( T ( 'Search' ) ) ; SaveToConfig ( 'Garden.Format.EmbedSize' , '160x90' , FALSE ) ; Gdn_Theme :: Section ( 'SearchResults' ) ; list ( $ Offset , $ Limit ) = OffsetLimit ( $ Page , C ( 'Garden.Search.PerPage' , 20 ) ) ; $ this -> SetData ( '_Limit' , $ Limit ) ; $ Search = $ this -> Form -> GetFormValue ( 'Search' ) ; $ Mode = $ this -> Form -> GetFormValue ( 'Mode' ) ; if ( $ Mode ) $ this -> SearchModel -> ForceSearchMode = $ Mode ; try { $ ResultSet = $ this -> SearchModel -> Search ( $ Search , $ Offset , $ Limit ) ; } catch ( Gdn_UserException $ Ex ) { $ this -> Form -> AddError ( $ Ex ) ; $ ResultSet = array ( ) ; } catch ( Exception $ Ex ) { LogException ( $ Ex ) ; $ this -> Form -> AddError ( $ Ex ) ; $ ResultSet = array ( ) ; } Gdn :: UserModel ( ) -> JoinUsers ( $ ResultSet , array ( 'UserID' ) ) ; // Fix up the summaries. $ SearchTerms = explode ( ' ' , Gdn_Format :: Text ( $ Search ) ) ; foreach ( $ ResultSet as & $ Row ) { $ Row [ 'Summary' ] = SearchExcerpt ( Gdn_Format :: PlainText ( $ Row [ 'Summary' ] , $ Row [ 'Format' ] ) , $ SearchTerms ) ; $ Row [ 'Format' ] = 'Html' ; } $ this -> SetData ( 'SearchResults' , $ ResultSet , TRUE ) ; $ this -> SetData ( 'SearchTerm' , Gdn_Format :: Text ( $ Search ) , TRUE ) ; if ( $ ResultSet ) $ NumResults = count ( $ ResultSet ) ; else $ NumResults = 0 ; if ( $ NumResults == $ Offset + $ Limit ) $ NumResults ++ ; // Build a pager $ PagerFactory = new Gdn_PagerFactory ( ) ; $ this -> Pager = $ PagerFactory -> GetPager ( 'MorePager' , $ this ) ; $ this -> Pager -> MoreCode = 'More Results' ; $ this -> Pager -> LessCode = 'Previous Results' ; $ this -> Pager -> ClientID = 'Pager' ; $ this -> Pager -> Configure ( $ Offset , $ Limit , $ NumResults , 'dashboard/search/%1$s/%2$s/?Search=' . Gdn_Format :: Url ( $ Search ) ) ; //		if ($this->_DeliveryType != DELIVERY_TYPE_ALL) { //         $this->SetJson('LessRow', $this->Pager->ToString('less')); //         $this->SetJson('MoreRow', $this->Pager->ToString('more')); //         $this->View = 'results'; //      } $ this -> CanonicalUrl ( Url ( 'search' , TRUE ) ) ; $ this -> Render ( ) ; }
docstring: Default search functionality.
  
  @since 2.0.0
  @access public
  @param int $Page Page number.
docstring_tokens: Default search functionality .