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


PHP Results::getFacetList方法代码示例

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


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

示例1: __invoke

 /**
  * Return the count of records when checkbox filter is activated.
  *
  * @param array                       $checkboxFilter Checkbox filter
  * @param \VuFind\Search\Base\Results $results        Search result set
  *
  * @return int Record count
  */
 public function __invoke($checkboxFilter, $results)
 {
     $ret = 0;
     list($field, $value) = $results->getParams()->parseFilter($checkboxFilter['filter']);
     $facets = $results->getFacetList([$field => $value]);
     if (isset($facets[$field])) {
         foreach ($facets[$field]['list'] as $item) {
             if ($item['value'] == $value || substr($value, -1) == '*' && preg_match('/^' . $value . '/', $item['value']) || $item['value'] == 'true' && $value == '1' || $item['value'] == 'false' && $value == '0') {
                 $ret += $item['count'];
             }
         }
     }
     return $ret;
 }
开发者ID:samuli,项目名称:vufind-ere,代码行数:22,代码来源:CheckboxFacetCounts.php

示例2: __invoke

 /**
  * Return the count of records when checkbox filter is activated.
  *
  * @param array                       $checkboxFilter Checkbox filter
  * @param \VuFind\Search\Base\Results $results        Search result set
  *
  * @return int Record count
  */
 public function __invoke($checkboxFilter, $results)
 {
     $ret = 0;
     list($field, $value) = $results->getParams()->parseFilter($checkboxFilter['filter']);
     $facets = $results->getFacetList([$field => $value]);
     if (isset($facets[$field])) {
         foreach ($facets[$field]['list'] as $item) {
             if ($item['value'] == $value || substr($value, -1) == '*' && preg_match('/^' . $value . '/', $item['value']) || $item['value'] == 'true' && $value == '1' || $item['value'] == 'false' && $value == '0') {
                 $ret += $item['count'];
             }
         }
     } elseif ($field == 'online_boolean' && $value == '1') {
         // Special case for online_boolean, which is translated to online_str_mv
         // when deduplication is enabled.
         // If we don't have a facet value for online_boolean it means we need to
         // do an additional lookup for online_str_mv.
         $results = clone $results;
         $params = $results->getParams();
         $options = $results->getOptions();
         $searchConfig = $this->getView()->getHelperPluginManager()->getServiceLocator()->get('VuFind\\Config')->get($options->getSearchIni());
         if (!empty($searchConfig->Records->sources)) {
             $sources = explode(',', $searchConfig->Records->sources);
             $sources = array_map(function ($s) {
                 return "\"{$s}\"";
             }, $sources);
             $params->addFilter('(online_str_mv:' . implode(' OR online_str_mv:', $sources) . ')');
         } else {
             $params->addFilter('online_str_mv:*');
         }
         $params->setLimit(0);
         $params->resetFacetConfig();
         $options->disableHighlighting();
         $options->spellcheckEnabled(false);
         $results->performAndProcessSearch();
         return $results->getResultTotal();
     }
     return $ret;
 }
开发者ID:bbeckman,项目名称:NDL-VuFind2,代码行数:46,代码来源:CheckboxFacetCounts.php

示例3: process

 /**
  * process
  *
  * Called after the Search Results object has performed its main search.  This
  * may be used to extract necessary information from the Search Results object
  * or to perform completely unrelated processing.
  *
  * @param \VuFind\Search\Base\Results $results Search results object
  *
  * @return void
  */
 public function process($results)
 {
     $this->results = $results;
     $filter = array();
     foreach ($this->config as $baseFacet => $exp) {
         $filter[$exp['field']] = $exp['label'];
     }
     $facetsToFilter = $results->getFacetList($filter);
     $filteredFacets = array();
     foreach ($facetsToFilter as $field => $cluster) {
         if (count($cluster['list']) > 1) {
             $filteredFacets[$field] = $cluster;
         }
     }
     $this->facets = $filteredFacets;
 }
开发者ID:paulusova,项目名称:VuFind-2.x,代码行数:27,代码来源:SpecifiableFacets.php

示例4: getExpandedSet

 /**
  * Get the facet data
  *
  * @return array
  */
 public function getExpandedSet()
 {
     return $this->searchObject->getFacetList($this->facets);
 }
开发者ID:datavoyager,项目名称:vufind,代码行数:9,代码来源:ExpandFacets.php


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