Class Zend_Search_Lucene

Description
  • license: New BSD License
  • copyright: Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)

Located in /Zend/Search/Lucene.php (line 71)


	
			
Method Summary
 static Zend_Search_Lucene create (mixed $directory)
 static string getDefaultSearchField ()
 static Zend_Search_Lucene open (mixed $directory)
 static void setDefaultSearchField (string $fieldName)
 Zend_Search_Lucene __construct ([mixed $directory = null], [ $create = false])
 void __destruct ()
 void commit ()
 integer count ()
 array find (mixed $query)
 array getFieldNames ([boolean $indexed = false])
 integer getMaxBufferedDocs ()
 integer getMaxMergeDocs ()
 integer getMergeFactor ()
 boolean hasDeletions ()
 boolean isDeleted (integer $id)
 integer maxDoc ()
 float norm (integer $id, string $fieldName)
 integer numDocs ()
 void optimize ()
 void setMaxBufferedDocs (integer $maxBufferedDocs)
 void setMaxMergeDocs (integer $maxMergeDocs)
 void setMergeFactor ( $mergeFactor, integer $maxMergeDocs)
 array terms ()
 void undeleteAll ()
Methods
static create (line 139)

Create index

  • access: public
static Zend_Search_Lucene create (mixed $directory)
  • mixed $directory
static getDefaultSearchField (line 363)

Get default search field.

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

  • access: public
static string getDefaultSearchField ()
static open (line 150)

Open index

  • access: public
static Zend_Search_Lucene open (mixed $directory)
  • mixed $directory
static setDefaultSearchField (line 351)

Set default search field.

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

Default value is null

  • access: public
static void setDefaultSearchField (string $fieldName)
  • string $fieldName
Constructor __construct (line 164)

Opens the index.

IndexReader constructor needs Directory as a parameter. It should be a string with a path to the index folder or a Directory object.

  • access: public
  • throws: Zend_Search_Lucene_Exception
Zend_Search_Lucene __construct ([mixed $directory = null], [ $create = false])
  • mixed $directory
  • $create
Destructor __destruct (line 241)

Object destructor

  • access: public
void __destruct ()
addDocument (line 913)

Adds a document to this index.

  • access: public
void addDocument (Zend_Search_Lucene_Document $document)
commit (line 936)

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

  • access: public
  • todo: undeleteAll processing.
void commit ()
count (line 284)

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

  • access: public
integer count ()
delete (line 882)

Deletes a document from the index.

$id is an internal document id

  • access: public
  • throws: Zend_Search_Lucene_Exception
void delete (integer|Zend_Search_Lucene_Search_QueryHit $id)
docFreq (line 804)

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

  • access: public
integer docFreq (Zend_Search_Lucene_Index_Term $term)
find (line 485)

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.

  • return: Zend_Search_Lucene_Search_QueryHit
  • access: public
  • throws: Zend_Search_Lucene_Exception
array find (mixed $query)
  • mixed $query
getDirectory (line 273)

Returns the Zend_Search_Lucene_Storage_Directory instance for this index.

  • access: public
getDocument (line 622)

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

  • access: public
getFieldNames (line 605)

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

  • access: public
array getFieldNames ([boolean $indexed = false])
  • boolean $indexed
getIndexWriter (line 258)

Returns an instance of Zend_Search_Lucene_Index_Writer for the index

  • access: public
getMaxBufferedDocs (line 378)

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

  • access: public
integer getMaxBufferedDocs ()
getMaxMergeDocs (line 410)

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

  • access: public
integer getMaxMergeDocs ()
getMergeFactor (line 449)

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

  • access: public
integer getMergeFactor ()
getSimilarity (line 823)

Retrive similarity used by index reader

  • access: public
hasDeletions (line 863)

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

  • access: public
boolean hasDeletions ()
hasTerm (line 689)

Returns true if index contain documents with specified term.

Is used for query optimization.

  • access: public
boolean hasTerm (Zend_Search_Lucene_Index_Term $term)
isDeleted (line 324)

Checks, that document is deleted

  • access: public
  • throws: Zend_Search_Lucene_Exception
boolean isDeleted (integer $id)
  • integer $id
maxDoc (line 296)

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.

  • access: public
integer maxDoc ()
norm (line 836)

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

  • access: public
float norm (integer $id, string $fieldName)
  • integer $id
  • string $fieldName
numDocs (line 306)

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

  • access: public
integer numDocs ()
optimize (line 959)

Optimize index.

Merges all segments into one

  • access: public
void optimize ()
setMaxBufferedDocs (line 393)

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

  • access: public
void setMaxBufferedDocs (integer $maxBufferedDocs)
  • integer $maxBufferedDocs
setMaxMergeDocs (line 427)

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

  • access: public
void setMaxMergeDocs (integer $maxMergeDocs)
  • integer $maxMergeDocs
setMergeFactor (line 471)

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

  • access: public
void setMergeFactor ( $mergeFactor, integer $maxMergeDocs)
  • integer $maxMergeDocs
  • $mergeFactor
termDocs (line 706)

Returns an array of all the documents which contain term.

  • access: public
array termDocs (Zend_Search_Lucene_Index_Term $term)
termPositions (line 749)

Returns an array of all term positions in the documents.

Return array structure: array( docId => array( pos1, pos2, ...), ...)

  • access: public
array termPositions (Zend_Search_Lucene_Index_Term $term)
terms (line 976)

Returns an array of all terms in this index.

  • access: public
array terms ()
undeleteAll (line 1019)

Undeletes all documents currently marked as deleted in this index.

  • access: public
  • todo: Implementation
void undeleteAll ()

Documentation generated on Wed, 21 Feb 2007 11:53:13 -0800 by phpDocumentor 1.3.1