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-2007 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
23 /** Zend_Search_Lucene_Exception */
24 require_once $CFG->dirroot
.'/search/Zend/Search/Lucene/Exception.php';
26 /** Zend_Search_Lucene_Index_SegmentInfo */
27 require_once $CFG->dirroot
.'/search/Zend/Search/Lucene/Index/SegmentInfo.php';
29 /** Zend_Search_Lucene_Index_SegmentWriter */
30 require_once $CFG->dirroot
.'/search/Zend/Search/Lucene/Index/SegmentWriter.php';
35 * @package Zend_Search_Lucene
37 * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
38 * @license http://framework.zend.com/license/new-bsd New BSD License
40 class Zend_Search_Lucene_Index_SegmentWriter_StreamWriter
extends Zend_Search_Lucene_Index_SegmentWriter
45 * @param Zend_Search_Lucene_Storage_Directory $directory
48 public function __construct(Zend_Search_Lucene_Storage_Directory
$directory, $name)
50 parent
::__construct($directory, $name);
55 * Create stored fields files and open them for write
57 public function createStoredFieldsFiles()
59 $this->_fdxFile
= $this->_directory
->createFile($this->_name
. '.fdx');
60 $this->_fdtFile
= $this->_directory
->createFile($this->_name
. '.fdt');
62 $this->_files
[] = $this->_name
. '.fdx';
63 $this->_files
[] = $this->_name
. '.fdt';
66 public function addNorm($fieldName, $normVector)
68 if (isset($this->_norms
[$fieldName])) {
69 $this->_norms
[$fieldName] .= $normVector;
71 $this->_norms
[$fieldName] = $normVector;
76 * Close segment, write it to disk and return segment info
78 * @return Zend_Search_Lucene_Index_SegmentInfo
80 public function close()
82 if ($this->_docCount
== 0) {
87 $this->_generateCFS();
89 return new Zend_Search_Lucene_Index_SegmentInfo($this->_name
,