mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 15:03:25 +00:00
Add highlights query
This commit is contained in:

committed by
Benoît Burnichon

parent
1ef4c1300d
commit
2d5a36f5a2
@@ -268,6 +268,12 @@ class ElasticSearchEngine implements SearchEngineInterface
|
||||
|
||||
$params['body']['from'] = $offset;
|
||||
$params['body']['size'] = $perPage;
|
||||
$params['body']['highlight'] = [
|
||||
'pre_tags' => ['[[em]]'],
|
||||
'post_tags' => ['[[/em]]'],
|
||||
'order' => 'score',
|
||||
'fields' => ['caption.*' => new \stdClass()]
|
||||
];
|
||||
|
||||
if ($aggs = $this->getAggregationQueryParams($options)) {
|
||||
$params['body']['aggs'] = $aggs;
|
||||
@@ -280,7 +286,7 @@ class ElasticSearchEngine implements SearchEngineInterface
|
||||
|
||||
$n = 0;
|
||||
foreach ($res['hits']['hits'] as $hit) {
|
||||
$results[] = ElasticsearchRecordHydrator::hydrate($hit['_source'], $n++);
|
||||
$results[] = ElasticsearchRecordHydrator::hydrate($hit, $n++);
|
||||
}
|
||||
|
||||
$facets = $this->facetsResponseFactory->__invoke($res);
|
||||
|
Reference in New Issue
Block a user