summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornickveenhof2015-10-24 09:21:08 (GMT)
committernickveenhof2015-10-24 09:21:08 (GMT)
commitc4e083972acff3a63c631cb6fabc429b3704f9be (patch)
tree02b25548886d5e49a80ddca67bc641728b243284
parent2d695cf4b3856a56b8811bd6cd0584173f379a4d (diff)
Moving search_api_term to search_api2588527
-rw-r--r--src/Plugin/facetapi/query_type/SearchApiTerm.php77
1 files changed, 0 insertions, 77 deletions
diff --git a/src/Plugin/facetapi/query_type/SearchApiTerm.php b/src/Plugin/facetapi/query_type/SearchApiTerm.php
deleted file mode 100644
index a37b4eb..0000000
--- a/src/Plugin/facetapi/query_type/SearchApiTerm.php
+++ /dev/null
@@ -1,77 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\facetapi\Plugin\facetapi\query_type\SearchApiTerm
- */
-
-namespace Drupal\facetapi\Plugin\facetapi\query_type;
-
-use \Drupal\facetapi\QueryType\QueryTypePluginBase;
-use Drupal\facetapi\Result\Result;
-use Drupal\search_api\Query\Query;
-
-
-/**
- * @FacetApiQueryType(
- * id = "search_api_term",
- * label = @Translation("Search api term"),
- * description = @Translation("Search api term"),
- * )
- *
- */
-class SearchApiTerm extends QueryTypePluginBase {
-
- /**
- * Add facet info to the query using the backend native query object.
- *
- * @return mixed
- */
- public function execute() {
- /** @var Query $query */
- $query = $this->query;
- // Alter the query here.
- if (! empty($query)) {
- $options = &$query->getOptions();
-
- $field_identifier = $this->facet->getFieldIdentifier();
- $options['search_api_facets'][$field_identifier] = array(
- 'field' => $field_identifier,
- 'limit' => 50,
- 'operator' => 'and',
- 'min_count' => 0,
- // Key used in SearchApiSolrBackend::extractFacets().
- 'missing' => FALSE,
- );
-
- // Add the filter to the query if there are active values.
- $active_items = $this->facet->getActiveItems();
- if (count($active_items)) {
- foreach ($active_items as $value) {
- $filter = $query->createFilter();
- $filter->condition($this->facet->getFieldIdentifier(), $value);
- $query->filter($filter);
- }
- }
- }
- }
-
- /**
- * Build the facet information,
- * so it can be rendered.
- *
- * @return mixed
- */
- public function build() {
- if (! empty ($this->results)) {
- $facet_results = array();
- foreach ($this->results as $result) {
- if ($result['count']) {
- $facet_results[] = new Result(trim($result['filter'], '"'), $result['count']);
- }
- }
- $this->facet->setResults($facet_results);
- }
- return $this->facet;
- }
-}