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


PHP ArticleSearch::getKeywordsFromSearchFilters方法代码示例

本文整理汇总了PHP中ArticleSearch::getKeywordsFromSearchFilters方法的典型用法代码示例。如果您正苦于以下问题:PHP ArticleSearch::getKeywordsFromSearchFilters方法的具体用法?PHP ArticleSearch::getKeywordsFromSearchFilters怎么用?PHP ArticleSearch::getKeywordsFromSearchFilters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ArticleSearch的用法示例。


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

示例1: queryAutocomplete

 /**
  * AJAX request for search query auto-completion.
  * @param $args array
  * @param $request Request
  * @return JSON string
  */
 function queryAutocomplete($args, $request)
 {
     $this->validate(null, $request);
     // Check whether auto-suggest is enabled.
     $suggestionList = array();
     $lucenePlugin = $this->_getLucenePlugin();
     $enabled = (bool) $lucenePlugin->getSetting(0, 'autosuggest');
     if ($enabled) {
         // Retrieve search criteria from the user input.
         $articleSearch = new ArticleSearch();
         $searchFilters = $articleSearch->getSearchFilters($request);
         // Get the autosuggest input and remove it from
         // the filter array.
         $autosuggestField = $request->getUserVar('searchField');
         $userInput = $searchFilters[$autosuggestField];
         if (isset($searchFilters[$autosuggestField])) {
             unset($searchFilters[$autosuggestField]);
         }
         // Instantiate a search request.
         $searchRequest = new SolrSearchRequest();
         $searchRequest->setJournal($searchFilters['searchJournal']);
         $searchRequest->setFromDate($searchFilters['fromDate']);
         $searchRequest->setToDate($searchFilters['toDate']);
         $keywords = $articleSearch->getKeywordsFromSearchFilters($searchFilters);
         $searchRequest->addQueryFromKeywords($keywords);
         // Get the web service.
         $solrWebService = $lucenePlugin->getSolrWebService();
         /* @var $solrWebService SolrWebService */
         $suggestions = $solrWebService->getAutosuggestions($searchRequest, $autosuggestField, $userInput, (int) $lucenePlugin->getSetting(0, 'autosuggestType'));
         // Prepare a suggestion list as understood by the
         // autocomplete JS handler.
         foreach ($suggestions as $suggestion) {
             $suggestionList[] = array('label' => $suggestion, 'value' => $suggestion);
         }
     }
     // Return the suggestions as JSON message.
     $json = new JSONMessage(true, $suggestionList);
     return $json->getString();
 }
开发者ID:laelnasan,项目名称:UTFPR-ojs,代码行数:45,代码来源:LuceneHandler.inc.php

示例2: search

 /**
  * Show the search form
  * @param $args array
  * @param $request PKPRequest
  */
 function search($args, $request)
 {
     $this->validate(null, $request);
     // Get and transform active filters.
     $articleSearch = new ArticleSearch();
     $searchFilters = $articleSearch->getSearchFilters($request);
     $keywords = $articleSearch->getKeywordsFromSearchFilters($searchFilters);
     // Get the range info.
     $rangeInfo = $this->getRangeInfo($request, 'search');
     // Retrieve results.
     $error = '';
     $results = $articleSearch->retrieveResults($request, $searchFilters['searchJournal'], $keywords, $error, $searchFilters['fromDate'], $searchFilters['toDate'], $rangeInfo);
     // Prepare and display the search template.
     $this->setupTemplate($request);
     $templateMgr = TemplateManager::getManager($request);
     $templateMgr->setCacheability(CACHEABILITY_NO_STORE);
     // Result set ordering options.
     $orderByOptions = $articleSearch->getResultSetOrderingOptions($request);
     $templateMgr->assign('searchResultOrderOptions', $orderByOptions);
     $orderDirOptions = $articleSearch->getResultSetOrderingDirectionOptions();
     $templateMgr->assign('searchResultOrderDirOptions', $orderDirOptions);
     // Result set ordering selection.
     list($orderBy, $orderDir) = $articleSearch->getResultSetOrdering($request);
     $templateMgr->assign('orderBy', $orderBy);
     $templateMgr->assign('orderDir', $orderDir);
     // Similar documents.
     $templateMgr->assign('simDocsEnabled', true);
     // Result set display.
     $templateMgr->assign('jsLocaleKeys', array('search.noKeywordError'));
     $this->_assignSearchFilters($request, $templateMgr, $searchFilters);
     $templateMgr->assign('results', $results);
     $templateMgr->assign('error', $error);
     $templateMgr->display('search/search.tpl');
 }
开发者ID:jmacgreg,项目名称:ojs,代码行数:39,代码来源:SearchHandler.inc.php

示例3: search

 /**
  * Show the search form
  * @param $args array
  * @param $request PKPRequest
  */
 function search($args, &$request)
 {
     $this->validate();
     // Get and transform active filters.
     $searchFilters = ArticleSearch::getSearchFilters($request);
     $keywords = ArticleSearch::getKeywordsFromSearchFilters($searchFilters);
     // Get the range info.
     $rangeInfo = $this->getRangeInfo('search');
     // Retrieve results.
     $error = '';
     $results =& ArticleSearch::retrieveResults($searchFilters['searchJournal'], $keywords, $error, $searchFilters['fromDate'], $searchFilters['toDate'], $rangeInfo);
     // Prepare and display the search template.
     $this->setupTemplate($request);
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->setCacheability(CACHEABILITY_NO_STORE);
     $templateMgr->assign('jsLocaleKeys', array('search.noKeywordError'));
     $this->_assignSearchFilters($request, $templateMgr, $searchFilters);
     $templateMgr->assign_by_ref('results', $results);
     $templateMgr->assign('error', $error);
     $templateMgr->display('search/search.tpl');
 }
开发者ID:EreminDm,项目名称:water-cao,代码行数:26,代码来源:SearchHandler.inc.php


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