API Documentation

Search/Lucene/Interface.php

Includes Interfaces
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Search_Lucene
version
$Id: Interface.php 20096 2010-01-06 02:05:09Z bkarwin $
Interfaces
Zend_Search_Lucene_Interface

Description

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.

Zend_Search_Lucene_Interface

Extends from
Zend_Search_Lucene_Index_TermsStream_Interface
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Search_Lucene
Methods
getActualGeneration
getSegmentFileName
getFormatVersion
setFormatVersion
getDirectory
count
maxDoc
numDocs
isDeleted
setDefaultSearchField
getDefaultSearchField
setResultSetLimit
getResultSetLimit
getMaxBufferedDocs
setMaxBufferedDocs
getMaxMergeDocs
setMaxMergeDocs
getMergeFactor
setMergeFactor
find
getFieldNames
getDocument
hasTerm
termDocs
termDocsFilter
termFreqs
termPositions
docFreq
getSimilarity
norm
hasDeletions
delete
addDocument
commit
optimize
terms
undeleteAll
addReference
removeReference

Description

Methods

addDocument

addDocument( Zend_Search_Lucene_Document $document ) :

Adds a document to this index.

Arguments
$document
Zend_Search_Lucene_Document
Details
visibility
public
final
false
static
false

addReference

addReference( ) :

Add reference to the index object

Details
visibility
public
final
false
static
false
internal

commit

commit( ) :

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

Details
visibility
public
final
false
static
false

count

count( ) : integer

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

Output
integer
Details
visibility
public
final
false
static
false

delete

delete( integer|Zend_Search_Lucene_Search_QueryHit $id ) :

Deletes a document from the index.

$id is an internal document id

Arguments
$id
integerZend_Search_Lucene_Search_QueryHit
Details
visibility
public
final
false
static
false
throws

docFreq

docFreq( Zend_Search_Lucene_Index_Term $term ) : integer

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

Arguments
$term
Zend_Search_Lucene_Index_Term
Output
integer
Details
visibility
public
final
false
static
false

find

find( 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.

Arguments
$query
mixed
Output
array
Zend_Search_Lucene_Search_QueryHit
Details
visibility
public
final
false
static
false
throws

getActualGeneration

getActualGeneration( Zend_Search_Lucene_Storage_Directory $directory ) : integer

Get current generation number

Returns generation number 0 means pre-2.1 index format -1 means there are no segments files.

Arguments
$directory
Zend_Search_Lucene_Storage_Directory
Output
integer
Details
visibility
public
final
false
static
true
throws

getDefaultSearchField

getDefaultSearchField( ) : string

Get default search field.

Null means, that search is performed through all fields by default

Output
string
Details
visibility
public
final
false
static
true

getDirectory

getDirectory( ) : Zend_Search_Lucene_Storage_Directory

Returns the Zend_Search_Lucene_Storage_Directory instance for this index.

Details
visibility
public
final
false
static
false

getDocument

getDocument( 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.

Arguments
$id
integerZend_Search_Lucene_Search_QueryHit
Details
visibility
public
final
false
static
false

getFieldNames

getFieldNames( boolean $indexed = false ) : array

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

Arguments
$indexed
boolean
Output
array
Details
visibility
public
final
false
static
false

getFormatVersion

getFormatVersion( ) : integer

Get index format version

Output
integer
Details
visibility
public
final
false
static
false

getMaxBufferedDocs

getMaxBufferedDocs( ) : 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

Output
integer
Details
visibility
public
final
false
static
false

getMaxMergeDocs

getMaxMergeDocs( ) : 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

Output
integer
Details
visibility
public
final
false
static
false

getMergeFactor

getMergeFactor( ) : 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

Output
integer
Details
visibility
public
final
false
static
false

getResultSetLimit

getResultSetLimit( ) : integer

Set result set limit.

0 means no limit

Output
integer
Details
visibility
public
final
false
static
true

getSegmentFileName

getSegmentFileName( integer $generation ) : string

Get segments file name

Arguments
$generation
integer
Output
string
Details
visibility
public
final
false
static
true

getSimilarity

getSimilarity( ) : Zend_Search_Lucene_Search_Similarity

Retrive similarity used by index reader

Details
visibility
public
final
false
static
false

hasDeletions

hasDeletions( ) : boolean

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

Output
boolean
Details
visibility
public
final
false
static
false

hasTerm

hasTerm( Zend_Search_Lucene_Index_Term $term ) : boolean

Returns true if index contain documents with specified term.

Is used for query optimization.

Arguments
$term
Zend_Search_Lucene_Index_Term
Output
boolean
Details
visibility
public
final
false
static
false

isDeleted

isDeleted( integer $id ) : boolean

Checks, that document is deleted

Arguments
$id
integer
Output
boolean
Details
visibility
public
final
false
static
false
throws
Exception is thrown if $id is out of the range

maxDoc

maxDoc( ) : 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.

Output
integer
Details
visibility
public
final
false
static
false

norm

norm( integer $id, string $fieldName ) : float

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

Arguments
$id
integer
$fieldName
string
Output
float
Details
visibility
public
final
false
static
false

numDocs

numDocs( ) : integer

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

Output
integer
Details
visibility
public
final
false
static
false

optimize

optimize( ) :

Optimize index.

Merges all segments into one

Details
visibility
public
final
false
static
false

removeReference

removeReference( ) :

Remove reference from the index object

When reference count becomes zero, index is closed and resources are cleaned up

Details
visibility
public
final
false
static
false
internal

setDefaultSearchField

setDefaultSearchField( string $fieldName ) :

Set default search field.

Null means, that search is performed through all fields by default

Default value is null

Arguments
$fieldName
string
Details
visibility
public
final
false
static
true

setFormatVersion

setFormatVersion( int $formatVersion ) :

Set index format version.

Index is converted to this format at the nearest upfdate time

Arguments
$formatVersion
int
Details
visibility
public
final
false
static
false
throws

setMaxBufferedDocs

setMaxBufferedDocs( integer $maxBufferedDocs ) :

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

Arguments
$maxBufferedDocs
integer
Details
visibility
public
final
false
static
false

setMaxMergeDocs

setMaxMergeDocs( integer $maxMergeDocs ) :

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

Arguments
$maxMergeDocs
integer
Details
visibility
public
final
false
static
false

setMergeFactor

setMergeFactor(  $mergeFactor ) :

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

Arguments
$mergeFactor
Details
visibility
public
final
false
static
false

setResultSetLimit

setResultSetLimit( integer $limit ) :

Set result set limit.

0 (default) means no limit

Arguments
$limit
integer
Details
visibility
public
final
false
static
true

termDocs

termDocs( Zend_Search_Lucene_Index_Term $term, Zend_Search_Lucene_Index_DocsFilter|null $docsFilter = null ) : array

Returns IDs of all the documents containing term.

Arguments
$term
Zend_Search_Lucene_Index_Term
$docsFilter
Zend_Search_Lucene_Index_DocsFilternull
Output
array
Details
visibility
public
final
false
static
false

termDocsFilter

termDocsFilter( 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

Arguments
$term
Zend_Search_Lucene_Index_Term
$docsFilter
Zend_Search_Lucene_Index_DocsFilternull
Details
visibility
public
final
false
static
false

termFreqs

termFreqs( 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, ...)

Arguments
$term
Zend_Search_Lucene_Index_Term
$docsFilter
Zend_Search_Lucene_Index_DocsFilternull
Output
integer
Details
visibility
public
final
false
static
false

termPositions

termPositions( 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, ...), ...)

Arguments
$term
Zend_Search_Lucene_Index_Term
$docsFilter
Zend_Search_Lucene_Index_DocsFilternull
Output
array
Details
visibility
public
final
false
static
false

terms

terms( ) : array

Returns an array of all terms in this index.

Output
array
Details
visibility
public
final
false
static
false

undeleteAll

undeleteAll( ) :

Undeletes all documents currently marked as deleted in this index.

Details
visibility
public
final
false
static
false
Documentation was generated by DocBlox.