Search/Lucene/Index/Writer.php
Zend Framework
LICENSE
This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to [email protected] so we can send you a copy immediately.
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Search_Lucene
- Subpackage
- Index
- Version
- $Id: Writer.php 24593 2012-01-05 20:35:02Z matthew $
\Zend_Search_Lucene_Index_Writer
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
Properties

\Zend_Search_Lucene_Index_SegmentWriter_DocumentWriter $_currentSegment = nullCurrent segment to add documents
nullDetails

\Zend_Search_Lucene_Storage_Directory $_directory = nullFile system adapter.
nullDetails

array $_indexExtensions = array('.cfs' => '.cfs', '.cfx' => '.cfx', '.fnm' => '.fnm', '.fdx' => '.fdx', '.fdt' => '.fdt', '.tis' => '.tis', '.tii' => '.tii', '.frq' => '.frq', '.prx' => '.prx', '.tvx' => '.tvx', '.tvd' => '.tvd', '.tvf' => '.tvf', '.del' => '.del', '.sti' => '.sti')List of indexfiles extensions
array('.cfs' => '.cfs', '.cfx' => '.cfx', '.fnm' => '.fnm', '.fdx' => '.fdx', '.fdt' => '.fdt', '.tis' => '.tis', '.tii' => '.tii', '.frq' => '.frq', '.prx' => '.prx', '.tvx' => '.tvx', '.tvd' => '.tvd', '.tvf' => '.tvf', '.del' => '.del', '.sti' => '.sti')Details- Type
- array

array $_newSegments = array()List of the segments, created by index writer Array of Zend_Search_Lucene_Index_SegmentInfo objects
array()Details- Type
- array

array $_segmentInfos = Array of Zend_Search_Lucene_Index_SegmentInfo objects for this index.
<p>Zend_Search_Lucene_Index_SegmentInfo</p>It's a reference to the corresponding Zend_Search_Lucene::$_segmentInfos array
- Type
- array

array $_segmentsToDelete = array()List of segments to be deleted on commit
array()Details- Type
- array

integer $maxBufferedDocs = 10Number of documents required before the buffered in-memory documents are written into a new Segment
Default value is 10
10Details- Type
- integer

integer $maxMergeDocs = PHP_INT_MAXLargest number of documents ever merged by addDocument().
Small values (e.g., less than 10,000) are best for interactive indexing, as this limits the length of pauses while indexing to a few seconds. Larger values are best for batched indexing and speedier searches.
Default value is PHP_INT_MAX
PHP_INT_MAXDetails- Type
- integer

integer $mergeFactor = 10Determines how often segment indices are merged by addDocument().
With smaller values, less RAM is used while indexing, and searches on unoptimized indices are faster, but indexing speed is slower.
With larger values, more RAM is used during indexing, and while searches on unoptimized indices are slower, indexing is faster.
Thus larger values (> 10) are best for batch index creation, and smaller values (< 10) for indices that are interactively maintained.
Default value is 10
10Details- Type
- integer
Methods

__construct(\Zend_Search_Lucene_Storage_Directory $directory, array $segmentInfos, integer $targetFormatVersion) : voidOpen the index for writing
| Name | Type | Description |
|---|---|---|
| $directory | \Zend_Search_Lucene_Storage_Directory | |
| $segmentInfos | array | |
| $targetFormatVersion | integer |

_mergeSegments(array $segments) : voidMerge specified segments
$segments is an array of SegmentInfo objects
| Name | Type | Description |
|---|---|---|
| $segments | array |

_updateSegments() : voidUpdate segments file by adding current segment to a list
| Exception | Description |
|---|---|
| \Zend_Search_Lucene_Exception |

addDocument(\Zend_Search_Lucene_Document $document) : voidAdds a document to this index.
| Name | Type | Description |
|---|---|---|
| $document | \Zend_Search_Lucene_Document |

addIndexes(array $readers) : voidMerges the provided indexes into this index.
| Name | Type | Description |
|---|---|---|
| $readers | array |

createIndex(\Zend_Search_Lucene_Storage_Directory $directory, integer $generation, integer $nameCount) : voidCreate empty index
| Name | Type | Description |
|---|---|---|
| $directory | \Zend_Search_Lucene_Storage_Directory | |
| $generation | integer | |
| $nameCount | integer |