protected function SearchApiElasticsearchBackend::createDateFieldFacet in Elasticsearch Connector 8.7
Same name and namespace in other branches
- 8 src/Plugin/search_api/backend/SearchApiElasticsearchBackend.php \Drupal\elasticsearch_connector\Plugin\search_api\backend\SearchApiElasticsearchBackend::createDateFieldFacet()
- 8.2 src/Plugin/search_api/backend/SearchApiElasticsearchBackend.php \Drupal\elasticsearch_connector\Plugin\search_api\backend\SearchApiElasticsearchBackend::createDateFieldFacet()
- 8.5 src/Plugin/search_api/backend/SearchApiElasticsearchBackend.php \Drupal\elasticsearch_connector\Plugin\search_api\backend\SearchApiElasticsearchBackend::createDateFieldFacet()
- 8.6 src/Plugin/search_api/backend/SearchApiElasticsearchBackend.php \Drupal\elasticsearch_connector\Plugin\search_api\backend\SearchApiElasticsearchBackend::createDateFieldFacet()
Helper function create Facet for date field type.
Parameters
mixed $facet_id: The facet id parameter.
array $facet: The facet parameter.
Return value
array Returns facet array.
1 call to SearchApiElasticsearchBackend::createDateFieldFacet()
- SearchApiElasticsearchBackend::addSearchFacets in src/
Plugin/ search_api/ backend/ SearchApiElasticsearchBackend.php - Helper function build facets in search.
File
- src/
Plugin/ search_api/ backend/ SearchApiElasticsearchBackend.php, line 965
Class
- SearchApiElasticsearchBackend
- Elasticsearch Search API Backend definition.
Namespace
Drupal\elasticsearch_connector\Plugin\search_api\backendCode
protected function createDateFieldFacet($facet_id, array $facet) {
$result = $facet[$facet_id];
$date_interval = $this
->getDateFacetInterval($facet_id);
$result['date_histogram']['interval'] = $date_interval;
// TODO: Check the timezone cause this hardcoded way doesn't seem right.
$result['date_histogram']['time_zone'] = 'UTC';
// Use factor 1000 as we store dates as seconds from epoch
// not milliseconds.
$result['date_histogram']['factor'] = 1000;
return $result;
}