Example #1
0
 /**
  * Return the document object for this hit
  *
  * @return Zend_Search_Lucene_Document
  */
 public function getDocument()
 {
     if (!$this->_document instanceof Zend_Search_Lucene_Document) {
         $this->_document = $this->_index->getDocument($this->id);
     }
     return $this->_document;
 }
Example #2
0
 /**
  *
  * @param int $id
  * @param Zend_Search_Lucene_Search_Query $query
  * @return array
  */
 public function getDocumentData($id, $query = null)
 {
     $highlighter = Axis::single('search/highlighter_default');
     $doc = $this->_index->getDocument($id);
     $result = array('type' => $doc->type, 'nameHighlight' => null === $query ? $doc->name : @$query->htmlFragmentHighlightMatches($doc->name, $this->_encoding, $highlighter), 'name' => $doc->name, 'contents' => null === $query ? $doc->contents : @$query->htmlFragmentHighlightMatches($doc->contents, $this->_encoding, $highlighter), 'urlHighlight' => null === $query ? $doc->url : @$query->htmlFragmentHighlightMatches($doc->url, $this->_encoding, $highlighter), 'url' => $doc->url);
     if (in_array($doc->type, array('product'))) {
         $result['image'] = $doc->image;
         $result['image_title'] = $doc->image_title;
     }
     return $result;
 }