You are here

public function SearchApiDisplay::getCount in Facets 8

Returns the number of results that were found for this search.

Return value

string The path of the facet.

Overrides FacetSourcePluginBase::getCount

File

src/Plugin/facets/facet_source/SearchApiDisplay.php, line 406

Class

SearchApiDisplay
Provides a facet source based on a Search API display.

Namespace

Drupal\facets\Plugin\facets\facet_source

Code

public function getCount() {
  $search_id = $this
    ->getDisplay()
    ->getPluginId();
  if ($search_id && !empty($search_id)) {
    if ($this->searchApiQueryHelper
      ->getResults($search_id) !== NULL) {
      return $this->searchApiQueryHelper
        ->getResults($search_id)
        ->getResultCount();
    }
  }
}