diff -r 5b37998e522e -r 162c1de6545a web/lib/Zend/Search/Lucene/Index/SegmentWriter/StreamWriter.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/lib/Zend/Search/Lucene/Index/SegmentWriter/StreamWriter.php Fri Mar 11 15:05:35 2011 +0100 @@ -0,0 +1,94 @@ +_fdxFile = $this->_directory->createFile($this->_name . '.fdx'); + $this->_fdtFile = $this->_directory->createFile($this->_name . '.fdt'); + + $this->_files[] = $this->_name . '.fdx'; + $this->_files[] = $this->_name . '.fdt'; + } + + public function addNorm($fieldName, $normVector) + { + if (isset($this->_norms[$fieldName])) { + $this->_norms[$fieldName] .= $normVector; + } else { + $this->_norms[$fieldName] = $normVector; + } + } + + /** + * Close segment, write it to disk and return segment info + * + * @return Zend_Search_Lucene_Index_SegmentInfo + */ + public function close() + { + if ($this->_docCount == 0) { + return null; + } + + $this->_dumpFNM(); + $this->_generateCFS(); + + /** Zend_Search_Lucene_Index_SegmentInfo */ + require_once 'Zend/Search/Lucene/Index/SegmentInfo.php'; + + return new Zend_Search_Lucene_Index_SegmentInfo($this->_directory, + $this->_name, + $this->_docCount, + -1, + null, + true, + true); + } +} +