Ejemplo n.º 1
0
 public function indexAction()
 {
     $queryBuilder = new Util_QueryBuilder($this->log, true);
     // support backward compatibility: interpret missing parameter searchtype as latest search
     if (is_null($this->getRequest()->getParam('searchtype', null))) {
         $this->getRequest()->setParam('searchtype', Util_Searchtypes::LATEST_SEARCH);
     }
     $params = array();
     try {
         $params = $queryBuilder->createQueryBuilderInputFromRequest($this->getRequest());
     } catch (Util_QueryBuilderException $e) {
         $this->log->err(__METHOD__ . ' : ' . $e->getMessage());
         throw new Application_Exception($e->getMessage());
     }
     // overwrite parameters in rss context
     // rss feeds have a fixed maximum number of items
     $params['rows'] = self::NUM_OF_ITEMS_PER_FEED;
     $params['start'] = 0;
     // rss feeds have both a fixed sort field and sort order
     $params['sortField'] = self::RSS_SORT_FIELD;
     $params['sortOrder'] = self::RSS_SORT_ORDER;
     $resultList = array();
     try {
         $searcher = new Opus_SolrSearch_Searcher();
         $resultList = $searcher->search($queryBuilder->createSearchQuery($params));
     } catch (Opus_SolrSearch_Exception $exception) {
         $this->handleSolrError($exception);
     }
     $this->loadStyleSheet($this->view->getScriptPath('') . 'stylesheets' . DIRECTORY_SEPARATOR . 'rss2_0.xslt');
     $this->setLink();
     $this->setDates($resultList);
     $this->setItems($resultList);
     $this->setFrontdoorBaseUrl();
 }
Ejemplo n.º 2
0
 /**
  * Sets up the xml query.
  */
 private function buildQuery($request)
 {
     $queryBuilder = new Util_QueryBuilder($this->getLogger(), true);
     $queryBuilderInput = array();
     try {
         $queryBuilderInput = $queryBuilder->createQueryBuilderInputFromRequest($request);
     } catch (Util_QueryBuilderException $e) {
         $this->getLogger()->err(__METHOD__ . ' : ' . $e->getMessage());
         throw new Application_Exception($e->getMessage());
     }
     return $queryBuilder->createSearchQuery($queryBuilderInput);
 }
Ejemplo n.º 3
0
 private function buildQuery()
 {
     $request = $this->getRequest();
     $queryBuilder = new Util_QueryBuilder($this->_logger);
     $queryBuilderInput = null;
     try {
         $queryBuilderInput = $queryBuilder->createQueryBuilderInputFromRequest($request);
     } catch (Util_BrowsingParamsException $e) {
         $this->_logger->err(__METHOD__ . ' : ' . $e->getMessage());
         return $this->_redirectToAndExit('index', '', 'browse', null, array(), true);
     } catch (Util_QueryBuilderException $e) {
         $this->_logger->err(__METHOD__ . ' : ' . $e->getMessage());
         return $this->_redirectToAndExit('index');
     }
     if (is_null($request->getParam('sortfield')) && ($request->getParam('browsing') === 'true' || $request->getParam('searchtype') === 'collection')) {
         $queryBuilderInput['sortField'] = 'server_date_published';
     }
     $this->searchtype = $request->getParam('searchtype');
     if ($this->searchtype === Util_Searchtypes::LATEST_SEARCH) {
         return $queryBuilder->createSearchQuery($this->validateInput($queryBuilderInput, 10, 100));
     }
     if ($this->searchtype === Util_Searchtypes::COLLECTION_SEARCH) {
         $this->prepareChildren();
     } else {
         if ($this->searchtype === Util_Searchtypes::SERIES_SEARCH) {
             $this->prepareSeries();
         }
     }
     return $queryBuilder->createSearchQuery($this->validateInput($queryBuilderInput));
 }