Elastica\Result::getHighlights PHP Method

getHighlights() public method

Returns result data.
public getHighlights ( ) : array
return array Result data array
    public function getHighlights()
    {
        return $this->getParam('highlight');
    }

Usage Example

 /**
  * This function returns an array of highlighted key-value pairs.
  * 
  * @param maxFields - the number of highlighted fields to return, 0 = all
  *
  * @return array of key value pairs
  */
 public function getHighlightedHitText($maxFields = 0)
 {
     $ret = array();
     $highlights = $this->elasticaResult->getHighlights();
     if (!empty($highlights) && is_array($highlights)) {
         $highlighter = new SugarSearchEngineHighlighter();
         $highlighter->setModule($this->getModule());
         $ret = $highlighter->processHighlightText($highlights);
         if ($maxFields > 0) {
             $ret = array_slice($ret, 0, $maxFields);
         }
     }
     return $ret;
 }
All Usage Examples Of Elastica\Result::getHighlights