7
* This source file is subject to the new BSD license that is bundled
8
* with this package in the file LICENSE.txt.
9
* It is also available through the world-wide-web at this URL:
10
* http://framework.zend.com/license/new-bsd
11
* If you did not receive a copy of the license and are unable to
12
* obtain it through the world-wide-web, please send an email
13
* to license@zend.com so we can send you a copy immediately.
16
* @package Zend_Search_Lucene
18
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
19
* @license http://framework.zend.com/license/new-bsd New BSD License
25
* @package Zend_Search_Lucene
27
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
28
* @license http://framework.zend.com/license/new-bsd New BSD License
30
class Zend_Search_Lucene_Search_QueryHit
33
* Object handle of the index
34
* @var Zend_Search_Lucene_Interface
36
protected $_index = null;
39
* Object handle of the document associated with this hit
40
* @var Zend_Search_Lucene_Document
42
protected $_document = null;
45
* Number of the document in the index
58
* Constructor - pass object handle of Zend_Search_Lucene_Interface index that produced
59
* the hit so the document can be retrieved easily from the hit.
61
* @param Zend_Search_Lucene_Interface $index
64
public function __construct(Zend_Search_Lucene_Interface $index)
66
$this->_index = new Zend_Search_Lucene_Proxy($index);
71
* Convenience function for getting fields from the document
72
* associated with this hit.
74
* @param string $offset
77
public function __get($offset)
79
return $this->getDocument()->getFieldValue($offset);
84
* Return the document object for this hit
86
* @return Zend_Search_Lucene_Document
88
public function getDocument()
90
if (!$this->_document instanceof Zend_Search_Lucene_Document) {
91
$this->_document = $this->_index->getDocument($this->id);
94
return $this->_document;
99
* Return the index object for this hit
101
* @return Zend_Search_Lucene_Interface
103
public function getIndex()
105
return $this->_index;