Search/Lucene/Proxy.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 license@zend.com 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  
Version
$Id$  

\Zend_Search_Lucene_Proxy

Package: Zend_Search_Lucene
Proxy class intended to be used in userland.
It tracks, when index object goes out of scope and forces ndex closing
Implements
Category
Zend  
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Properties

>VPropertyprivate\Zend_Search_Lucene_Interface $_index
Index object

Methods

methodpublic__construct(\Zend_Search_Lucene_Interface $index) : void

Object constructor

Parameters
NameTypeDescription
$index\Zend_Search_Lucene_Interface
methodpublic__destruct() : void

Object destructor

methodpublicaddDocument(\Zend_Search_Lucene_Document $document) : void

Adds a document to this index.

Parameters
NameTypeDescription
$document\Zend_Search_Lucene_Document
methodpubliccloseTermsStream() : void

Close terms stream

Should be used for resources clean up if stream is not read up to the end
methodpubliccommit() : void

Commit changes resulting from delete() or undeleteAll() operations.

methodpubliccount() : integer

Returns the total number of documents in this index (including deleted documents).

Returns
TypeDescription
integer
methodpubliccurrentTerm() : \Zend_Search_Lucene_Index_Term | null

Returns term in current position

Returns
TypeDescription
\Zend_Search_Lucene_Index_Term | null
methodpublicdelete(integer | \Zend_Search_Lucene_Search_QueryHit $id) : void

Deletes a document from the index.

$id is an internal document id
Parameters
NameTypeDescription
$idinteger | \Zend_Search_Lucene_Search_QueryHit
Throws
ExceptionDescription
\Zend_Search_Lucene_Exception
methodpublicdocFreq(\Zend_Search_Lucene_Index_Term $term) : integer

Returns the number of documents in this index containing the $term.

Parameters
NameTypeDescription
$term\Zend_Search_Lucene_Index_Term
Returns
TypeDescription
integer
methodpublicfind(mixed $query) : array

Performs a query against the index and returns an array of Zend_Search_Lucene_Search_QueryHit objects.

Input is a string or Zend_Search_Lucene_Search_Query.
Parameters
NameTypeDescription
$querymixed
Returns
TypeDescription
arrayZend_Search_Lucene_Search_QueryHit
Throws
ExceptionDescription
\Zend_Search_Lucene_Exception
methodpublicgetActualGeneration(\Zend_Search_Lucene_Storage_Directory $directory) : integer
static

Get current generation number

Returns generation number 0 means pre-2.1 index format -1 means there are no segments files.
Parameters
NameTypeDescription
$directory\Zend_Search_Lucene_Storage_Directory
Returns
TypeDescription
integer
Throws
ExceptionDescription
\Zend_Search_Lucene_Exception
methodpublicgetDefaultSearchField() : string
static

Get default search field.

Null means, that search is performed through all fields by default
Returns
TypeDescription
string
methodpublicgetDirectory() : \Zend_Search_Lucene_Storage_Directory

Returns the Zend_Search_Lucene_Storage_Directory instance for this index.

methodpublicgetDocument(integer | \Zend_Search_Lucene_Search_QueryHit $id) : \Zend_Search_Lucene_Document

Returns a Zend_Search_Lucene_Document object for the document number $id in this index.

Parameters
NameTypeDescription
$idinteger | \Zend_Search_Lucene_Search_QueryHit
Returns
TypeDescription
\Zend_Search_Lucene_Document
methodpublicgetFieldNames(boolean $indexed = false) : array

Returns a list of all unique field names that exist in this index.

Parameters
NameTypeDescription
$indexedboolean
Returns
TypeDescription
array
methodpublicgetFormatVersion() : integer

Get index format version

Returns
TypeDescription
integer
methodpublicgetMaxBufferedDocs() : integer

Retrieve index maxBufferedDocs option

maxBufferedDocs is a minimal number of documents required before the buffered in-memory documents are written into a new Segment Default value is 10
Returns
TypeDescription
integer
methodpublicgetMaxMergeDocs() : integer

Retrieve index maxMergeDocs option

maxMergeDocs is a 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
Returns
TypeDescription
integer
methodpublicgetMergeFactor() : integer

Retrieve index mergeFactor option

mergeFactor 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
Returns
TypeDescription
integer
methodpublicgetResultSetLimit() : integer
static

Set result set limit.

0 means no limit
Returns
TypeDescription
integer
methodpublicgetSegmentFileName(integer $generation) : string
static

Get segments file name

Parameters
NameTypeDescription
$generationinteger
Returns
TypeDescription
string
methodpublicgetSimilarity() : \Zend_Search_Lucene_Search_Similarity

Retrive similarity used by index reader

methodpublichasDeletions() : boolean

Returns true if any documents have been deleted from this index.

Returns
TypeDescription
boolean
methodpublichasTerm(\Zend_Search_Lucene_Index_Term $term) : boolean

Returns true if index contain documents with specified term.

Is used for query optimization.
Parameters
NameTypeDescription
$term\Zend_Search_Lucene_Index_Term
Returns
TypeDescription
boolean
methodpublicisDeleted(integer $id) : boolean

Checks, that document is deleted

Parameters
NameTypeDescription
$idinteger
Returns
TypeDescription
boolean
Throws
ExceptionDescription
\Zend_Search_Lucene_ExceptionException is thrown if $id is out of the range
methodpublicmaxDoc() : integer

Returns one greater than the largest possible document number.

This may be used to, e.g., determine how big to allocate a structure which will have an element for every document number in an index.
Returns
TypeDescription
integer
methodpublicnextTerm() : \Zend_Search_Lucene_Index_Term | null

Scans terms dictionary and returns next term

Returns
TypeDescription
\Zend_Search_Lucene_Index_Term | null
methodpublicnorm(integer $id, string $fieldName) : float

Returns a normalization factor for "field, document" pair.

Parameters
NameTypeDescription
$idinteger
$fieldNamestring
Returns
TypeDescription
float
methodpublicnumDocs() : integer

Returns the total number of non-deleted documents in this index.

Returns
TypeDescription
integer
methodpublicoptimize() : void

Optimize index.

Merges all segments into one
methodpublicresetTermsStream() : void

Reset terms stream.

methodpublicsetDefaultSearchField(string $fieldName) : void
static

Set default search field.

Null means, that search is performed through all fields by default Default value is null
Parameters
NameTypeDescription
$fieldNamestring
methodpublicsetFormatVersion(int $formatVersion) : void

Set index format version.

Index is converted to this format at the nearest upfdate time
Parameters
NameTypeDescription
$formatVersionint
Throws
ExceptionDescription
\Zend_Search_Lucene_Exception
methodpublicsetMaxBufferedDocs(integer $maxBufferedDocs) : void

Set index maxBufferedDocs option

maxBufferedDocs is a minimal number of documents required before the buffered in-memory documents are written into a new Segment Default value is 10
Parameters
NameTypeDescription
$maxBufferedDocsinteger
methodpublicsetMaxMergeDocs(integer $maxMergeDocs) : void

Set index maxMergeDocs option

maxMergeDocs is a 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
Parameters
NameTypeDescription
$maxMergeDocsinteger
methodpublicsetMergeFactor( $mergeFactor) : void

Set index mergeFactor option

mergeFactor 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
Parameters
NameTypeDescription
$mergeFactor
methodpublicsetResultSetLimit(integer $limit) : void
static

Set result set limit.

0 (default) means no limit
Parameters
NameTypeDescription
$limitinteger
methodpublicskipTo(\Zend_Search_Lucene_Index_Term $prefix) : void

Skip terms stream up to specified term preffix.

Prefix contains fully specified field info and portion of searched term
Parameters
NameTypeDescription
$prefix\Zend_Search_Lucene_Index_Term
methodpublictermDocs(\Zend_Search_Lucene_Index_Term $term, \Zend_Search_Lucene_Index_DocsFilter | null $docsFilter = null) : array

Returns IDs of all the documents containing term.

Parameters
NameTypeDescription
$term\Zend_Search_Lucene_Index_Term
$docsFilter\Zend_Search_Lucene_Index_DocsFilter | null
Returns
TypeDescription
array
methodpublictermDocsFilter(\Zend_Search_Lucene_Index_Term $term, \Zend_Search_Lucene_Index_DocsFilter | null $docsFilter = null) : \Zend_Search_Lucene_Index_DocsFilter

Returns documents filter for all documents containing term.

It performs the same operation as termDocs, but return result as Zend_Search_Lucene_Index_DocsFilter object
Parameters
NameTypeDescription
$term\Zend_Search_Lucene_Index_Term
$docsFilter\Zend_Search_Lucene_Index_DocsFilter | null
Returns
TypeDescription
\Zend_Search_Lucene_Index_DocsFilter
methodpublictermFreqs(\Zend_Search_Lucene_Index_Term $term, \Zend_Search_Lucene_Index_DocsFilter | null $docsFilter = null) : integer

Returns an array of all term freqs.

Return array structure: array( docId => freq, ...)
Parameters
NameTypeDescription
$term\Zend_Search_Lucene_Index_Term
$docsFilter\Zend_Search_Lucene_Index_DocsFilter | null
Returns
TypeDescription
integer
methodpublictermPositions(\Zend_Search_Lucene_Index_Term $term, \Zend_Search_Lucene_Index_DocsFilter | null $docsFilter = null) : array

Returns an array of all term positions in the documents.

Return array structure: array( docId => array( pos1, pos2, ...), ...)
Parameters
NameTypeDescription
$term\Zend_Search_Lucene_Index_Term
$docsFilter\Zend_Search_Lucene_Index_DocsFilter | null
Returns
TypeDescription
array
methodpublicterms() : array

Returns an array of all terms in this index.

Returns
TypeDescription
array
methodpublicundeleteAll() : void

Undeletes all documents currently marked as deleted in this index.

Documentation was generated by phpDocumentor 2.2.0 .