[ Index ] |
|
Code source de PRADO 3.0.6 |
1 <?php 2 /** 3 * Zend Framework 4 * 5 * LICENSE 6 * 7 * This source file is subject to version 1.0 of the Zend Framework 8 * license, that is bundled with this package in the file LICENSE, and 9 * is available through the world-wide-web at the following URL: 10 * http://www.zend.com/license/framework/1_0.txt. If you did not receive 11 * a copy of the Zend Framework license and are unable to obtain it 12 * through the world-wide-web, please send a note to license@zend.com 13 * so we can mail you a copy immediately. 14 * 15 * @package Zend_Search_Lucene 16 * @subpackage document 17 * @copyright Copyright (c) 2005-2006 Zend Technologies USA Inc. (http://www.zend.com) 18 * @license http://www.zend.com/license/framework/1_0.txt Zend Framework License version 1.0 19 */ 20 21 22 /** Zend_Search_Lucene_Field */ 23 require_once 'Zend/Search/Lucene/Field.php'; 24 25 26 /** 27 * A Document is a set of fields. Each field has a name and a textual value. 28 * 29 * @package Zend_Search_Lucene 30 * @subpackage document 31 * @copyright Copyright (c) 2005-2006 Zend Technologies Inc. (http://www.zend.com) 32 * @license Zend Framework License version 1.0 33 */ 34 class Zend_Search_Lucene_Document 35 { 36 37 /** 38 * Associative array Zend_Search_Lucene_Field objects where the keys to the 39 * array are the names of the fields. 40 * 41 * @var array 42 */ 43 protected $_fields = array(); 44 45 public $boost = 1.0; 46 47 48 /** 49 * Proxy method for getFieldValue(), provides more convenient access to 50 * the string value of a field. 51 * 52 * @param $offset 53 * @return string 54 */ 55 public function __get($offset) 56 { 57 return $this->getFieldValue($offset); 58 } 59 60 61 /** 62 * Add a field object to this document. 63 * 64 * @param Zend_Search_Lucene_Field $field 65 */ 66 public function addField(Zend_Search_Lucene_Field $field) 67 { 68 $this->_fields[$field->name] = $field; 69 } 70 71 72 /** 73 * Return an array with the names of the fields in this document. 74 * 75 * @return array 76 */ 77 public function getFieldNames() 78 { 79 return array_keys($this->_fields); 80 } 81 82 83 /** 84 * Returns Zend_Search_Lucene_Field object for a named field in this document. 85 * 86 * @param string $fieldName 87 * @return Zend_Search_Lucene_Field 88 */ 89 public function getField($fieldName) 90 { 91 if (!array_key_exists($fieldName, $this->_fields)) { 92 throw new Zend_Search_Lucene_Exception("Field name \"$fieldName\" not found in document."); 93 } 94 return $this->_fields[$fieldName]; 95 } 96 97 98 /** 99 * Returns the string value of a named field in this document. 100 * 101 * @see __get() 102 * @return string 103 */ 104 public function getFieldValue($fieldName) 105 { 106 return $this->getField($fieldName)->stringValue; 107 } 108 109 }
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 21:07:04 2007 | par Balluche grâce à PHPXref 0.7 |