コード例 #1
0
 /**
  * Check spelling, reset search refinements and redirect to results
  * 
  * @return \Symfony\Component\HttpFoundation\RedirectResponse
  */
 public function searchAction()
 {
     // set the url params for where we are gong to redirect,
     // usually to the results action, but can be overriden
     $base = $this->helper->searchRedirectParams();
     $params = $this->query->getAllSearchParams();
     $params = array_merge($base, $params);
     // check spelling
     $this->checkSpelling();
     // remove default values
     foreach ($params as $id => $value) {
         if (strstr($id, 'field')) {
             if ($value == 'keyword') {
                 unset($params[$id]);
             }
         }
     }
     // keep search refinements if user says so
     if ($this->request->getParam('clear-facets') != '') {
         $this->request->setSessionData('clear_facets', $this->request->getParam('clear-facets'));
     }
     // redirect
     return $this->redirectTo($params);
 }
コード例 #2
0
ファイル: Worldcat.php プロジェクト: navtis/xerxes-pazpar2
 /**
  * Parameters to construct the url on the search redirect
  * Accounts for worldcat 'source' identifier
  * @return array
  */
 public function searchRedirectParams()
 {
     $params = parent::searchRedirectParams();
     $params['source'] = $this->request->getParam('source');
     return $params;
 }