/** The index action
  * @access public
  * @return void
  */
 public function indexAction()
 {
     $search = new Pas_Solr_Handler();
     $search->setCore('content');
     $search->setFields(array('*'));
     $search->setFacets(array('section'));
     $search->setParams($this->getAllParams());
     $search->execute();
     $this->view->query = $this->getParam('q');
     $this->view->facets = $search->processFacets();
     $this->view->paginator = $search->createPagination();
     $this->view->results = $search->processResults();
 }
 /** Display an index of news stories
  * @access public
  * @return void
  */
 public function indexAction()
 {
     $form = new ContentSearchForm();
     $form->submit->setLabel('Search content');
     $this->view->form = $form;
     $cleaner = new Pas_ArrayFunctions();
     $params = $cleaner->array_cleanup($this->getAllParams());
     $search = new Pas_Solr_Handler();
     $search->setCore('content');
     $search->setFields(array('updated', 'updatedBy', 'publishState', 'title', 'created', 'createdBy', 'id'));
     if ($this->getRequest()->isPost() && !is_null($this->getParam('submit'))) {
         if ($form->isValid($this->_request->getPost())) {
             $params = $cleaner->array_cleanup($form->getValues());
             $this->_helper->Redirector->gotoSimple('index', 'news', 'admin', $params);
         } else {
             $form->populate($form->getValues());
             $params = $form->getValues();
         }
     } else {
         $params = $this->getAllParams();
         $form->populate($this->getAllParams());
     }
     if (!isset($params['q']) || $params['q'] == '') {
         $params['q'] = '*';
     }
     $params['type'] = 'news';
     $search->setParams($params);
     $search->execute();
     $this->view->paginator = $search->createPagination();
     $this->view->news = $search->processResults();
 }
 /** Set up the index page
  * @access public
  * @return void
  */
 public function indexAction()
 {
     $select = array('query' => 'reeceID:[* TO *]');
     $params = $this->getAllParams();
     $search = new Pas_Solr_Handler();
     $search->setCore('objects');
     $context = $this->_helper->contextSwitch->getCurrentContext();
     $fields = new Pas_Solr_FieldGeneratorFinds($context);
     $params['format'] = $context;
     $search->setFields($fields->getFields());
     $search->setFacets(array('reeceID'));
     $search->setParams($params);
     $search->execute();
     $statistics = $search->processFacets();
     $stats = array();
     foreach ($statistics['reeceID'] as $k => $v) {
         $stats[$k] = (string) $v;
     }
     ksort($stats);
     $cleaned = array();
     foreach ($stats as $k => $v) {
         $cleaned[] = array('period_name' => 'Reece period ' . $k, 'description' => $v, 'id' => $k);
     }
     $this->view->reeces = $cleaned;
 }
Beispiel #4
0
 public function __construct()
 {
     $user = new Pas_User_Details();
     $this->_user = $user->getPerson();
     $this->_dateTime = Zend_Date::now()->toString('yyyyMMddHHmmss');
     $backendOptions = array('cache_dir' => APPLICATION_PATH . '/tmp');
     $this->_memory = Zend_Memory::factory('File', $backendOptions);
     $params = Zend_Controller_Front::getInstance()->getRequest()->getParams();
     $this->_params = $this->_cleanParams($params);
     $this->_search = new Pas_Solr_Handler();
     $this->_search->setCore('objects');
 }
 /** Display index page
  * Display all content in the system Solr indexed
  * @access public
  * @return void
  */
 public function indexAction()
 {
     $form = new ContentSearchForm();
     $form->submit->setLabel('Search content');
     $this->view->form = $form;
     $params = $this->getCleaner()->array_cleanup($this->getAllParams());
     $search = new Pas_Solr_Handler();
     $search->setCore('content');
     if ($this->getRequest()->isPost()) {
         if ($form->isValid($this->_request->getPost())) {
             $params = $this->getCleaner()->array_cleanup($form->getValues());
             $this->_helper->Redirector->gotoSimple('index', 'content', 'admin', $params);
         } else {
             $form->populate($form->getValues());
             $params = $form->getValues();
         }
     } else {
         $form->populate($this->getAllParams());
     }
     if (!isset($params['q']) || $params['q'] == '') {
         $params['q'] = '*';
     }
     $params['type'] = 'sitecontent';
     $params['page'] = $this->getParam('page');
     $search->setParams($params);
     $search->execute();
     $this->view->paginator = $search->createPagination();
     $this->view->contents = $search->processResults();
 }
 /** Display of publications with filtration
  * @access public
  * @return void
  */
 public function indexAction()
 {
     $form = new SolrForm();
     $form->removeElement('thumbnail');
     $form->removeElement('3D');
     $form->q->setLabel('Search the publications: ');
     $form->q->setAttrib('placeholder', 'Try Geake for example');
     $this->view->form = $form;
     $cleaner = new Pas_ArrayFunctions();
     $params = $cleaner->array_cleanup($this->getAllParams());
     $search = new Pas_Solr_Handler();
     $search->setCore('publications');
     $search->setFields(array('*'));
     $search->setFacets(array('publisher', 'yearPublished'));
     if ($this->getRequest()->isPost() && $form->isValid($this->_request->getPost()) && !is_null($this->getParam('submit'))) {
         if ($form->isValid($form->getValues())) {
             // ensure that the URL contains the value in the 'q' textbox (it might change) so
             // that it can be bookmarked etc.
             $params['q'] = $form->q->getValue();
             $this->_helper->Redirector->gotoSimple('index', 'publications', 'database', $params);
         } else {
             $form->populate($form->getValues());
             $params = $form->getValues();
         }
     } else {
         $params = $this->getAllParams();
         $form->populate($params);
     }
     if (!isset($params['q']) || $params['q'] == '') {
         $params['q'] = '*';
     }
     $params['sort'] = 'title';
     $params['direction'] = 'asc';
     $search->setParams($params);
     $search->execute();
     $this->view->facets = $search->processFacets();
     $this->view->paginator = $search->createPagination();
     $this->view->results = $search->processResults();
 }
 /** Set up the index list
  * @access public
  * @return void
  */
 public function indexAction()
 {
     $person = $this->getAccount();
     if (!is_null($person->peopleID)) {
         $params = $this->getAllParams();
         $params['finderID'] = $person->peopleID;
         $params['-createdBy'] = $person->id;
         $search = new Pas_Solr_Handler();
         $search->setCore('objects');
         $search->setFields(array('id', 'identifier', 'objecttype', 'title', 'broadperiod', 'imagedir', 'filename', 'thumbnail', 'old_findID', 'description', 'county', 'workflow'));
         $search->setFacets(array('objectType', 'county', 'broadperiod', 'institution'));
         $search->setParams($params);
         $search->execute();
         $this->view->paginator = $search->createPagination();
         $this->view->finds = $search->processResults();
         $this->view->facets = $search->processFacets();
     } else {
         $this->redirect('/error/accountconnection');
     }
 }
 /** Display a paginated list of OS data points
  */
 public function indexAction()
 {
     $form = new SolrForm();
     $form->removeElement('thumbnail');
     $form->q->setLabel('Search OS open data: ');
     $form->q->setAttribs(array('placeholder' => 'Try barrow for instance'));
     $this->view->form = $form;
     $params = $this->getAllParams();
     $search = new Pas_Solr_Handler();
     $search->setCore('geodata');
     $search->setFields(array('*'));
     $search->setFacets(array('county'));
     if ($this->getRequest()->isPost() && !is_null($this->getParam('submit'))) {
         if ($form->isValid($this->_request->getPost())) {
             $params = $form->getValues();
             unset($params['csrf']);
             $this->_helper->Redirector->gotoSimple('index', 'osdata', 'datalabs', $params);
         } else {
             $form->populate($form->getValues());
             $params = $form->getValues();
         }
     } else {
         $form->populate($this->_request->getPost());
     }
     $q = $this->getParam('q');
     if (is_null($q)) {
         $params['q'] = 'type:R OR type:A';
     } else {
         $params['q'] = 'type:R || type:A && ' . $q;
     }
     $params['source'] = 'osdata';
     $params['sort'] = 'id';
     $params['direction'] = 'asc';
     $search->setParams($params);
     $search->execute();
     $this->view->paginator = $search->createPagination();
     $this->view->results = $search->processResults();
     $this->view->facets = $search->processFacets();
 }
 /** Create the facets boxes for rendering
  * @access public
  * @param  array $facets
  * @return string
  * @throws Pas_Exception
  */
 public function mapFacetCreator()
 {
     $params = Zend_Controller_Front::getInstance()->getRequest()->getParams();
     $search = new Pas_Solr_Handler();
     $search->setCore('objects');
     $search->setParams($params);
     $search->setFacets(array('objectType', 'county', 'broadperiod', 'institution', 'rulerName', 'denominationName', 'mintName', 'workflow'));
     $search->setMap(true);
     $search->execute();
     $facets = $search->processFacets();
     $total = $search->getNumber();
     if (is_array($facets)) {
         $html = '<p>Total results available: ' . number_format($total) . '<br />These results might differ to the expected results. We only allow you to see records available to you</p>';
         $html .= '<h3 class="lead">Search facets</h3>';
         foreach ($facets as $facetName => $facet) {
             $html .= $this->_processFacet($facet, $facetName);
         }
         return $html;
     } else {
         throw new Pas_Exception('The facets sent are not an array');
     }
 }
 /** Create the facets boxes for rendering
  * @access public
  * @param  array $facets
  * @return string
  * @throws Pas_Exception
  */
 public function mapFacetCreatorMyFinds()
 {
     $params = Zend_Controller_Front::getInstance()->getRequest()->getParams();
     $params['createdBy'] = $this->_id;
     $search = new Pas_Solr_Handler();
     $search->setCore('objects');
     $search->setParams($params);
     $search->setFacets(array('objectType', 'county', 'broadperiod', 'institution', 'rulerName', 'denominationName', 'mintName', 'workflow'));
     $search->setMap(true);
     $search->execute();
     $facets = $search->processFacets();
     if (is_array($facets)) {
         $html = '<h3 class="lead">Search facets</h3>';
         foreach ($facets as $facetName => $facet) {
             $html .= $this->_processFacet($facet, $facetName);
         }
         return $html;
     } else {
         throw new Pas_Exception('The facets sent are not an array');
     }
 }
 public function taggedAction()
 {
     if ($this->getParam('term', false)) {
         $params = $this->getAllParams();
         $search = new Pas_Solr_Handler();
         $search->setCore('tags');
         $context = $this->_helper->contextSwitch->getCurrentContext();
         if ($context) {
             $params['format'] = $context;
         }
         $search->setParams($params);
         $search->execute();
         $this->view->paginator = $search->createPagination();
         $this->view->results = $search->processResults();
         $this->view->server = $search->getLoadBalancerKey();
     } else {
         throw new Pas_Exception_Param($this->_missingParameter, 500);
     }
 }
 /** Get the data from the solr index
  * @access public
  * @param  string $constituency
  * @return int
  */
 public function getSolr($constituency)
 {
     $geometry = $this->getGeometry($constituency);
     $bbox = array($geometry->min_lat, $geometry->min_lon, $geometry->max_lat, $geometry->max_lon);
     $search = new Pas_Solr_Handler();
     $search->setCore('objects');
     $search->setFields(array('id', 'identifier', 'objecttype', 'title', 'broadperiod', 'imagedir', 'filename', 'thumbnail', 'old_findID', 'description', 'county'));
     $search->setParams(array('bbox' => implode(',', $bbox)));
     $search->execute();
     $this->_geometry = implode(',', $bbox);
     return $search->getNumber();
 }
 /** Display details of a person
  * @access public
  * @return void
  */
 public function personAction()
 {
     if ($this->getParam('id', false)) {
         $params = array();
         $person = $this->getPeople()->getPersonDetails($this->getParam('id'));
         if ($this->_helper->contextSwitch()->getCurrentContext() !== 'vcf') {
             $search = new Pas_Solr_Handler();
             $search->setCore('objects');
             $fields = new Pas_Solr_FieldGeneratorFinds($this->getCurrentContext());
             $search->setFields($fields->getFields());
             $params['finderID'] = $person['0']['secuid'];
             $params['page'] = $this->getParam('page');
             $search->setParams($params);
             $search->execute();
             $this->view->paginator = $search->createPagination();
             $this->view->finds = $search->processResults();
         }
         $this->view->peoples = $person;
     } else {
         throw new Pas_Exception_Param($this->_missingParameter, 500);
     }
 }
 /** Display all images that a user has added.
  * 
  */
 public function myimagesAction()
 {
     $search = new Pas_Solr_Handler('beowulf');
     $search->setFields(array('id', 'identifier', 'objecttype'));
     $search->setFacets(array('period' => 'broadperiod', 'object' => 'objectType'));
     Zend_Debug::dump($search->execute(array('createdBy' => 56)));
     exit;
     $config = array('adapteroptions' => array('host' => '127.0.0.1', 'port' => 8983, 'path' => '/solr/', 'core' => 'beoimages'));
     $select = array('query' => '*:*', 'start' => $this->getStart(), 'rows' => $this->getLimit(), 'fields' => array('*'), 'sort' => array('created' => 'desc'), 'filterquery' => array());
     $client = new Solarium_Client($config);
     // get a select query instance based on the config
     $query = $client->createSelect($select);
     if (!is_null($d) && !is_null($lon) && !is_null($lat)) {
         $helper = $query->getHelper();
         $query->createFilterQuery('geo')->setQuery($helper->geofilt($lat, $lon, 'coordinates', $d));
     }
     $query->createFilterQuery('myimages')->setQuery('createdBy:' . $this->getIdentityForForms());
     $resultset = $client->select($query);
     $this->view->paginator = $this->createPagination($resultset);
     $this->view->results = $this->processResults($resultset);
 }
 /** Display index page of images
  * @access public
  * @return void
  */
 public function indexAction()
 {
     $form = new SolrForm();
     $form->removeElement('thumbnail');
     $form->removeElement('3D');
     $this->view->form = $form;
     $search = new Pas_Solr_Handler();
     $search->setCore('images');
     $search->setFields(array('id', 'identifier', 'objecttype', 'title', 'broadperiod', 'imagedir', 'filename', 'thumbnail', 'old_findID', 'county', 'licenseAcronym', 'findID', 'institution'));
     $search->setFacets(array('licenseAcronym', 'broadperiod', 'county', 'objecttype', 'institution'));
     if ($this->getRequest()->isPost() && $form->isValid($this->_request->getPost()) && !is_null($this->getParam('submit'))) {
         //Check if valid
         if ($form->isValid($form->getValues())) {
             $params = $this->_arrayTools->array_cleanup($form->getValues());
             $this->_helper->Redirector->gotoSimple('index', 'images', 'database', $params);
         } else {
             //if failed, refill form
             $form->populate($this->_request->getPost());
             $params = $form->getValues();
         }
     } else {
         $params = $this->getAllParams();
         $form->populate($this->getAllParams());
     }
     //If q parameter is not set or is '', set default query
     if (!isset($params['q']) || $params['q'] == '') {
         $params['q'] = '*';
     }
     $params['show'] = 18;
     //Set the search params
     $search->setParams($params);
     //Execute the search
     $search->execute();
     //Process the facets
     $search->processFacets();
     //Send pagination to view
     $this->view->paginator = $search->createPagination();
     //Send results to view
     $this->view->results = $search->processResults();
     //Send facets to view
     $this->view->facets = $search->processFacets();
 }
Beispiel #16
0
 /** My images facet overlay
  * @access public
  * @return void
  */
 public function myimagesfacetAction()
 {
     $search = new Pas_Solr_Handler();
     $search->setCore('images');
     $context = $this->_helper->contextSwitch->getCurrentContext();
     $fields = new Pas_Solr_FieldGeneratorFinds($context);
     $search->setFields($fields->getFields());
     $search->setFacets(array('licenseAcronym', 'broadperiod', 'county', 'objecttype', 'institution'));
     $params = $this->getAllParams();
     $params['createdBy'] = $this->getIdentityForForms();
     $search->setParams($params);
     $search->execute();
     $data = array('facets' => $search->processFacets());
     $this->view->data = $data;
     $this->view->facetName = $this->getParam('facetType');
 }