For the common use cases you don’t need to tweek the settings. The.fulltext() in the search query which the Search plugin uses already activates the highlighting. So it should work out-of-the-box. The highlighting can be adjusted using .highlight() .
Have you adjusted the search query / output somehow?
I didn’t changed the search query. In the mean time I found out that the issue has to be elasticsearch.
I have activated logging for the search query via .log() and could see that the highlight:{} part is in the query. The result directly from ES via curl has the search word is in the __fulltext* fragment, but ES didn’t highlighted it.
Any clue what could cause this behavior? I’m using ES 2.4.6 via docker and I have added the following, as mentioned in the doc, to my elasticsearch.yml:
network.host: 0.0.0.0
script.inline: true
cluster.name: es2xdev
# the following settings are well-suited for smaller Elasticsearch instances (e.g. as long as you can stay on one host)
index.number_of_shards: 1
index.number_of_replicas: 0
@daniellienert I have also tested it with the Neos.Demo package, added "flowpack/searchplugin": "3.0.*" and had the same issue. If I’m using the example from elastic.io docu where “match” is used the higlighting works like expected. I tested it with the curl and the contenten of Neos.Demo Page:
Would you mind if you can reproduce my issue or do you see on the following steps I did my mistake?
I’m using ES 2.4.5 from Docker, Neos 3.1 with Neos.Demo Package and PHP 7.1.8.
My steps:
Pulled docker image, started the image and added the settings to the elasticsearch.yml
network.host: 0.0.0.0
script.inline: true
cluster.name: es2xdev
# the following settings are well-suited for smaller Elasticsearch instances (e.g. as long as you can stay on one host)
index.number_of_shards: 1
index.number_of_replicas: 0