Search/Lucene/Index/Writer.php

Show: PublicProtectedPrivateinherited
Table of Contents
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-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Search_Lucene  
Subpackage
Index  
Version
$Id$  

\Zend_Search_Lucene_Index_Writer

Package: Zend_Search_Lucene\Index
Category
Zend  
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Properties

>VPropertyprivate\Zend_Search_Lucene_Index_SegmentWriter_DocumentWriter $_currentSegment = null
Current segment to add documents
>VPropertyprivate\Zend_Search_Lucene_Storage_Directory $_directory = null
File system adapter.
Default valuenullDetails
Type
\Zend_Search_Lucene_Storage_Directory
>VPropertyprivatearray $_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')
static
List of indexfiles extensions
Default valuearray('.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
>VPropertyprivatearray $_newSegments = array()
List of the segments, created by index writer Array of Zend_Search_Lucene_Index_SegmentInfo objects
Default valuearray()Details
Type
array
>VPropertyprivatearray $_segmentInfos
Array of Zend_Search_Lucene_Index_SegmentInfo objects for this index.
It's a reference to the corresponding Zend_Search_Lucene::$_segmentInfos array
Details
Type
array
>VPropertyprivatearray $_segmentsToDelete = array()
List of segments to be deleted on commit
Default valuearray()Details
Type
array
>VPropertyprivateinteger $_targetFormatVersion
Index target format version
Details
Type
integer
>VPropertyprivateinteger $_versionUpdate = 0
Changes counter.
Default value0Details
Type
integer
>VPropertypublicinteger $maxBufferedDocs = 10
Number of documents required before the buffered in-memory documents are written into a new Segment
Default value is 10
Default value10Details
Type
integer
>VPropertypublicinteger $maxMergeDocs = PHP_INT_MAX
Largest 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
Default valuePHP_INT_MAXDetails
Type
integer
>VPropertypublicinteger $mergeFactor = 10
Determines 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
Default value10Details
Type
integer

Methods

methodpublic__construct(\Zend_Search_Lucene_Storage_Directory $directory, array $segmentInfos, integer $targetFormatVersion) : void

Open the index for writing

Parameters
NameTypeDescription
$directory\Zend_Search_Lucene_Storage_Directory
$segmentInfosarray
$targetFormatVersioninteger
methodprivate_hasAnythingToMerge() : boolean

Check if we have anything to merge

Returns
TypeDescription
boolean
methodprivate_maybeMergeSegments() : void

Merge segments if necessary

methodprivate_mergeSegments(array $segments) : void

Merge specified segments

$segments is an array of SegmentInfo objects
Parameters
NameTypeDescription
$segmentsarray
methodprivate_newSegmentName() : string

Get name for new segment

Returns
TypeDescription
string
methodprivate_updateSegments() : void

Update segments file by adding current segment to a list

Throws
ExceptionDescription
\Zend_Search_Lucene_Exception
methodpublicaddDocument(\Zend_Search_Lucene_Document $document) : void

Adds a document to this index.

Parameters
NameTypeDescription
$document\Zend_Search_Lucene_Document
methodpublicaddIndexes(array $readers) : void

Merges the provided indexes into this index.

Parameters
NameTypeDescription
$readersarray
methodpubliccommit() : void

Commit current changes

methodpubliccreateIndex(\Zend_Search_Lucene_Storage_Directory $directory, integer $generation, integer $nameCount) : void
static

Create empty index

Parameters
NameTypeDescription
$directory\Zend_Search_Lucene_Storage_Directory
$generationinteger
$nameCountinteger
methodpublicoptimize() : boolean

Merges all segments together into new one

Returns true on success and false if another optimization or auto-optimization process is running now
Returns
TypeDescription
boolean
Documentation was generated by phpDocumentor 2.2.0 .