This query works for me.
$hl = $query->getHighlighting();
$hl->setFields('autocomplete');
$hl->setSimplePrefix('');
$hl->setSimplePostfix('');
$resultSet = $client->select($query);
$highlighting = $resultSet->getHighlighting();
However,the following doesn't seem to work.
$main_query = 'autocomplete:'.$autocomplete;
$select = array(
'query' => $main_query,
'rows' => 1000,
'component' => array('highlighting' => array('fields' =>'autocomplete')));
$query = $client->createSelect($select);
$resultSet = $client->select($query);
$highlighting = $resultSet->getHighlighting();
What is that I am doing wrong in my second implementation?
Figured out the solution myself.
'component' => array('highlighting' => array('field' =>'autocomplete')));
The parameter name of highlighting component is field but I had used fields.