Open razor2611 opened 9 years ago
I am also looking for this I tried to add it in myself but I'm thinking the low level php library might not support it or something. Still investigating will let you know what I find out.
Was able to get it working by modifying the searchByQuery function. I am going to generalize it a bit and then I will put up a pull request.
I really don't like the way the parameters work in the searchByQuery function. $query, $aggs, $sort and $sourceFields could all be condensed into one parameter $body. That would allow for much more flexibility without having a million parameters. Then you could do stuff like highlighting without having to add another parameter to support it. If you wanted to be able to still separate things out, you could have setter functions (setQuery, setAggregations, setHighlight, setFields, setSort) that build out the one parameter you pass into searchByQuery. When I get some time I am going to go ahead and do this on my fork if anyone is interested. I need highlighting support but I don't want to add yet another parameter.
@modernmediaca, I agree. Please have a look at https://github.com/elasticquent/Elasticquent, which I have forked from @adamfairholm (I already have some of your commits there in that repository).
@razor2611 have you seen the documentation? https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-highlighting.html
You will need to change your query function a little to make it work.
Any example on how we can use highlighting?