当前位置: 首页>>代码示例>>PHP>>正文


PHP SearchObjectFactory类代码示例

本文整理汇总了PHP中SearchObjectFactory的典型用法代码示例。如果您正苦于以下问题:PHP SearchObjectFactory类的具体用法?PHP SearchObjectFactory怎么用?PHP SearchObjectFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了SearchObjectFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: loadSavedSearch

 /**
  * Load a saved search, if appropriate and legal; assign an error to the
  * interface if necessary.
  *
  * @access  protected
  * @return  SearchObject_Base|boolean mixed           Search Object on successful load, false otherwise
  */
 protected function loadSavedSearch()
 {
     global $interface;
     global $user;
     // Are we editing an existing search?
     if (isset($_REQUEST['edit']) || isset($_SESSION['lastSearchId'])) {
         // Go find it
         $search = new SearchEntry();
         $search->id = isset($_REQUEST['edit']) ? $_REQUEST['edit'] : $_SESSION['lastSearchId'];
         if ($search->find(true)) {
             // Check permissions
             if ($search->session_id == session_id() || $search->user_id == $user->id) {
                 // Retrieve the search details
                 $minSO = unserialize($search->search_object);
                 $savedSearch = SearchObjectFactory::deminify($minSO);
                 // Make sure it's an advanced search
                 if ($savedSearch->getSearchType() == 'advanced') {
                     // Activate facets so we get appropriate descriptions
                     // in the filter list:
                     $savedSearch->activateAllFacets('Advanced');
                     return $savedSearch;
                 } else {
                     $interface->assign('editErr', 'notAdvanced');
                 }
                 // No permissions
             } else {
                 $interface->assign('editErr', 'noRights');
             }
             // Not found
         } else {
             $interface->assign('editErr', 'notFound');
         }
     }
     return false;
 }
开发者ID:victorfcm,项目名称:VuFind-Plus,代码行数:42,代码来源:AdvancedBase.php

示例2: launch

 function launch()
 {
     global $interface;
     global $timer;
     global $logger;
     $interface->assign('sidebar', 'GroupedWork/full-record-sidebar.tpl');
     $id = $_REQUEST['id'];
     require_once ROOT_DIR . '/RecordDrivers/GroupedWorkDriver.php';
     $recordDriver = new GroupedWorkDriver($id);
     if (!$recordDriver->isValid) {
         $logger->log("Did not find a record for id {$id} in solr.", PEAR_LOG_DEBUG);
         $interface->setTemplate('../Record/invalidRecord.tpl');
         $interface->display('layout.tpl');
         die;
     }
     $interface->assign('recordDriver', $recordDriver);
     $timer->logTime('Initialized the Record Driver');
     // Retrieve User Search History
     $interface->assign('lastsearch', isset($_SESSION['lastSearchURL']) ? $_SESSION['lastSearchURL'] : false);
     //Get Next/Previous Links
     $searchSource = isset($_REQUEST['searchSource']) ? $_REQUEST['searchSource'] : 'local';
     /** @var SearchObject_Solr $searchObject */
     $searchObject = SearchObjectFactory::initSearchObject();
     $searchObject->init($searchSource);
     $searchObject->getNextPrevLinks();
     $interface->setPageTitle($recordDriver->getTitle());
     $interface->assign('moreDetailsOptions', $recordDriver->getMoreDetailsOptions());
     $interface->assign('moreDetailsTemplate', 'GroupedWork/moredetails-accordion.tpl');
     $interface->setTemplate('full-record.tpl');
     $interface->assign('metadataTemplate', 'GroupedWork/metadata.tpl');
     // Display Page
     $interface->display('layout.tpl');
 }
开发者ID:victorfcm,项目名称:VuFind-Plus,代码行数:33,代码来源:Home.php

示例3: __construct

 public function __construct($indexFields)
 {
     if (is_string($indexFields)) {
         $id = $indexFields;
         //Just got a record id, let's load the full record from Solr
         // Setup Search Engine Connection
         $searchObject = SearchObjectFactory::initSearchObject();
         $searchObject->disableScoping();
         if (function_exists('disableErrorHandler')) {
             disableErrorHandler();
         }
         // Retrieve the record from Solr
         if (!($record = $searchObject->getRecord($id))) {
             $this->isValid = false;
         } else {
             $this->fields = $record;
         }
         $searchObject->enableScoping();
         if (function_exists('enableErrorHandler')) {
             enableErrorHandler();
         }
     } else {
         $this->fields = $indexFields;
     }
 }
开发者ID:victorfcm,项目名称:VuFind-Plus,代码行数:25,代码来源:GroupedWorkDriver.php

示例4: launch

 /**
  * Process incoming parameters and display the page.
  *
  * @return void
  * @access public
  */
 public function launch()
 {
     // Initialise from the current search globals
     $searchObject = SearchObjectFactory::initSearchObject();
     $searchObject->init();
     $this->showResults($searchObject);
 }
开发者ID:bharatm,项目名称:NDL-VuFind,代码行数:13,代码来源:Results.php

示例5: launch

 function launch()
 {
     global $interface;
     // Create our search object
     /** @var SearchObject_Solr|SearchObject_Base $searchObject */
     $searchObject = SearchObjectFactory::initSearchObject();
     $searchObject->initAdvancedFacets();
     // We don't want this search in the search history
     $searchObject->disableLogging();
     // Go get the facets
     $searchObject->processSearch();
     $facetList = $searchObject->getFacetList();
     //print_r($facetList);
     // Shutdown the search object
     $searchObject->close();
     // Load a saved search, if any:
     $savedSearch = $this->loadSavedSearch();
     if ($savedSearch) {
         $searchTerms = $savedSearch->getSearchTerms();
         $searchGroups = array();
         $numGroups = 0;
         foreach ($searchTerms as $search) {
             $groupStart = true;
             $numItemsInGroup = count($search['group']);
             $curItem = 0;
             foreach ($search['group'] as $group) {
                 $searchGroups[$numGroups] = array('groupStart' => $groupStart ? 1 : 0, 'searchType' => $group['field'], 'lookfor' => $group['lookfor'], 'join' => $group['bool'], 'groupEnd' => ++$curItem === $numItemsInGroup ? 1 : 0);
                 $groupStart = false;
                 $numGroups++;
             }
         }
         $interface->assign('searchGroups', $searchGroups);
     }
     //Get basic search types
     $basicSearchTypes = $searchObject->getBasicTypes();
     $interface->assign('basicSearchTypes', $basicSearchTypes);
     // Send search type settings to the template
     $advSearchTypes = $searchObject->getAdvancedTypes();
     //Remove any basic search types
     foreach ($basicSearchTypes as $basicTypeKey => $basicType) {
         unset($advSearchTypes[$basicTypeKey]);
     }
     foreach ($advSearchTypes as $advSearchKey => $label) {
         $advSearchTypes[$advSearchKey] = translate($label);
     }
     natcasesort($advSearchTypes);
     $interface->assign('advSearchTypes', $advSearchTypes);
     foreach ($facetList as $facetKey => $facetData) {
         $facetList[$facetKey] = translate($facetData['label']);
     }
     natcasesort($facetList);
     $interface->assign('facetList', $facetList);
     header('Content-type: application/json');
     header('Cache-Control: no-cache, must-revalidate');
     // HTTP/1.1
     header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
     // Date in the past
     $results = array('title' => 'Advanced Search', 'modalBody' => $interface->fetch("Search/advancedPopup.tpl"), 'modalButtons' => "<span class='tool btn btn-primary' onclick='VuFind.Searches.submitAdvancedSearch(); return false;'>Find</span>");
     echo json_encode($results);
 }
开发者ID:victorfcm,项目名称:VuFind-Plus,代码行数:60,代码来源:AdvancedPopup.php

示例6: launch

 /**
  * Process incoming parameters and display the page.
  *
  * @return void
  * @access public
  */
 public function launch()
 {
     global $interface;
     global $configArray;
     header('Content-type: text/html');
     header('Cache-Control: no-cache, must-revalidate');
     // HTTP/1.1
     header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
     // Date in the past
     // Set Proxy URL
     if (isset($configArray['EZproxy']['host'])) {
         $interface->assign('proxy', $configArray['EZproxy']['host']);
     }
     $collection = $_REQUEST['collection'];
     // Initialise from the current search globals
     $searchObject = SearchObjectFactory::initSearchObject();
     $searchObject->collection_id($collection);
     $searchObject->init();
     $results = $searchObject->processSearch();
     $results = $results['response']['docs'];
     //print_r($results);
     $interface->assign('recordSet', $results);
     $summary = $searchObject->getResultSummary();
     $interface->assign('recordCount', $summary['resultTotal']);
     $interface->assign('completeListUrl', $searchObject->renderLinkWithLimit(20));
     $interface->display('AJAX/ResultGoogleMapInfo.tpl');
 }
开发者ID:bharatm,项目名称:NDL-VuFind,代码行数:33,代码来源:CollectionGoogleMapInfo.php

示例7: noop

 /**
  * No-op, just verify that VuFind is up and running
  *
  * @return true
  * @access public
  */
 public function noop()
 {
     // Verify that the index is up
     $searchObject = SearchObjectFactory::initSearchObject();
     $searchObject->init();
     $searchObject->getIndexEngine();
     return $this->output(true, JSON::STATUS_OK);
 }
开发者ID:bharatm,项目名称:NDL-VuFind,代码行数:14,代码来源:JSON_KeepAlive.php

示例8: __construct

 /**
  * Constructor
  *
  * @access public
  */
 public function __construct()
 {
     global $action;
     parent::__construct();
     $this->searchObject = SearchObjectFactory::initSearchObject('PCI');
     $this->filterField = 'creationdate';
     $this->dateFacet = 'creationdate';
 }
开发者ID:bharatm,项目名称:NDL-VuFind,代码行数:13,代码来源:JSON_DateRangeVisPCI.php

示例9: __construct

 /**
  * Constructor
  *
  * @access public
  */
 public function __construct()
 {
     global $interface;
     $interface->assign('currentTab', 'Authority');
     // Send Authority search types to the template so the basic search box can
     // function on all pages of the Authority UI.
     $this->searchObject = SearchObjectFactory::initSearchObject('SolrAuth');
     $interface->assign('authSearchTypes', $this->searchObject->getBasicTypes());
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:14,代码来源:Base.php

示例10: setUp

 /**
  * Standard setup method.
  *
  * @return void
  * @access public
  */
 public function setUp()
 {
     global $configArray;
     $this->oldConfigArray = $configArray;
     // Load the default configuration:
     $configArray = parse_ini_file(dirname(__FILE__) . '/../../conf/config.ini', true);
     $this->_searchObject = SearchObjectFactory::initSearchObject('Solr');
     // TODO: load from config
     $this->field = "unit_daterange";
 }
开发者ID:bharatm,项目名称:NDL-VuFind,代码行数:16,代码来源:SolrPseudoFacetsTest.php

示例11: __construct

 /**
  * Constructor.
  *
  * @access public
  */
 public function __construct()
 {
     parent::__construct();
     $this->_searchObject = SearchObjectFactory::initSearchObject();
     // Load the desired facet information...
     $config = getExtraConfigArray('facets');
     if (isset($config['MapFacets']['location'])) {
         $this->_locationFacet = is_array($config['MapFacets']['location']) ? $config['MapFacets']['location'] : array($config['MapFacets']['location']);
     }
 }
开发者ID:bharatm,项目名称:NDL-VuFind,代码行数:15,代码来源:JSON_GoogleMap.php

示例12: launch

 /**
  * Process incoming parameters and display the page.
  *
  * @return void
  * @access public
  */
 public function launch()
 {
     global $configArray;
     global $interface;
     global $user;
     // Fetch List object
     $list = User_list::staticGet($_GET['id']);
     if (!$list->public && $list->user_id != $user->id) {
         PEAR::raiseError(new PEAR_Error(translate('list_access_denied')));
     }
     $interface->assign('list', $list);
     $interface->assign('publicList', true);
     $interface->assign('ownList', $list->user_id == $user->id);
     $date = new VuFindDate();
     if (strtotime($list->modified) !== false && strtotime($list->modified) > 0) {
         $interface->assign('listModified', $date->convertToDisplayDate('Y-m-d H:i:s', $list->modified));
     }
     // Load the User object for the owner of the list (if necessary):
     if ($user && $user->id == $list->user_id) {
         $listUser = $user;
     } else {
         $listUser = User::staticGet($list->user_id);
     }
     $listOwner = null;
     if ($listUser->email && ($pos = strpos($listUser->email, '@')) !== false) {
         $listOwner = substr($listUser->email, 0, $pos);
     } else {
         if ($listUser->firstname && $listUser->lastname) {
             $listOwner = "{$listUser->firstname} {$listUser->lastname}";
         }
     }
     if ($listOwner) {
         $interface->assign('listUsername', $listOwner);
     }
     $searchObject = SearchObjectFactory::initSearchObject();
     $searchObject->init();
     $interface->assign('viewList', $searchObject->getViewList());
     // Build Favorites List
     $favorites = $list->getResources(isset($_GET['tag']) ? $_GET['tag'] : null);
     // Create a handler for displaying favorites and use it to assign
     // appropriate template variables:
     $favList = new FavoriteHandler($favorites, $listUser, $list->id, false);
     $favList->initPublicListView($searchObject->getView(), $listOwner);
     $favList->assign();
     $interface->assign('recordSet', $interface->get_template_vars('resourceList'));
     $interface->assign('openUrlAutoCheck', true);
     $currentView = $searchObject->getView();
     $interface->assign('subpage', 'Search/list-' . $currentView . '.tpl');
     $interface->setTemplate('home.tpl');
     $interface->setPageTitle($list->title);
     $interface->display('layout.tpl');
 }
开发者ID:bharatm,项目名称:NDL-VuFind,代码行数:58,代码来源:Home.php

示例13: launch

 function launch()
 {
     global $interface;
     $interface->caching = false;
     // Retrieve User Search History
     $interface->assign('lastsearch', isset($_SESSION['lastSearchURL']) ? $_SESSION['lastSearchURL'] : false);
     // Initialise from the current search globals
     $searchObject = SearchObjectFactory::initSearchObject();
     $searchObject->init();
     // TODO : Stats
     $result = $searchObject->processSearch();
     if (PEAR_Singleton::isError($result)) {
         PEAR_Singleton::raiseError($result->getMessage());
     }
     $interface->assign('sortList', $searchObject->getSortList());
     $interface->assign('lookfor', $searchObject->displayQuery());
     $interface->assign('searchType', $searchObject->getSearchType());
     $interface->assign('searchIndex', $searchObject->getSearchIndex());
     $interface->assign('qtime', round($searchObject->getQuerySpeed(), 2));
     $summary = $searchObject->getResultSummary();
     // Post processing, remember that the REAL results here with regards to
     //   numbers and pagination are the author facet, not the document
     //   results from the solr index. So access '$summary' with care.
     $page = $summary['page'];
     $limit = $summary['perPage'];
     // The search object will have returned an array of author facets that
     // is offset to display the current page of results but which has more
     // than a single page worth of content.  This allows a user to dig deeper
     // and deeper into the result set even though we have no way of finding
     // out the exact count of results without risking a memory overflow or
     // long delay.  We need to use the current page information to adjust the
     // known total count accordingly, and we need to use the page size to
     // crop off extra results when displaying the list to the user.
     // See VUFIND-127 in JIRA for more details.
     $authors = $result['facet_counts']['facet_fields']['authorStr'];
     $cnt = ($page - 1) * $limit + count($authors);
     $interface->assign('recordSet', array_slice($authors, 0, $limit));
     $interface->assign('recordCount', $cnt);
     $interface->assign('recordStart', ($page - 1) * $limit + 1);
     if ($cnt < $limit || $page * $limit > $cnt) {
         $interface->assign('recordEnd', $cnt);
     } else {
         $interface->assign('recordEnd', $page * $limit);
     }
     $link = $searchObject->renderLinkPageTemplate();
     $options = array('totalItems' => $cnt, 'fileName' => $link);
     $pager = new VuFindPager($options);
     $interface->assign('pageLinks', $pager->getLinks());
     $interface->setPageTitle('Author Browse');
     $interface->setTemplate('list.tpl');
     $interface->display('layout.tpl');
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:52,代码来源:Search.php

示例14: __construct

 /**
  * Constructor
  *
  * Establishes base settings for making recommendations.
  *
  * @param object $searchObject The SearchObject requesting recommendations.
  * @param string $params       Colon-separated settings from config file.
  *
  * @access public
  */
 public function __construct($searchObject, $params)
 {
     // Parse out parameters:
     $params = explode(':', $params);
     $requestParam = empty($params[0]) ? 'lookfor' : $params[0];
     $limit = isset($params[1]) && is_numeric($params[1]) && $params[1] > 0 ? intval($params[1]) : 5;
     // We don't actually care about the passed-in search object; let's just
     // create our own!
     $this->_searchObject = SearchObjectFactory::initSearchObject('Summon');
     $this->_searchObject->disableLogging();
     $this->_searchObject->setBasicQuery($_REQUEST[$requestParam]);
     $this->_searchObject->setLimit($limit);
 }
开发者ID:bharatm,项目名称:NDL-VuFind,代码行数:23,代码来源:SummonResults.php

示例15: testInitSearchObject

 /**
  * Test initialization of SearchObjects
  *
  * @return void
  * @access public
  */
 public function testInitSearchObject()
 {
     // Test valid options:
     $options = array('Solr', 'SolrAuth', 'Summon', 'WorldCat');
     foreach ($options as $current) {
         $obj = SearchObjectFactory::initSearchObject($current);
         $this->assertTrue(is_object($obj));
         $this->assertEquals('SearchObject_' . $current, get_class($obj));
     }
     // Test invalid option:
     $obj = SearchObjectFactory::initSearchObject('IllegalGarbage');
     $this->assertFalse($obj);
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:19,代码来源:SearchObjectFactoryTest.php


注:本文中的SearchObjectFactory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。