Class Zend_Search_Lucene

Description

Implements interfaces:

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

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


	
			
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 close ()
 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 152)

Create index

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

Get default search field.

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

  • access: public
static string getDefaultSearchField ()

Implementation of:
Zend_Search_Lucene_Interface::getDefaultSearchField()
Get default search field.
static open (line 163)

Open index

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

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

Implementation of:
Zend_Search_Lucene_Interface::setDefaultSearchField()
Set default search field.
Constructor __construct (line 177)

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 274)

Object destructor

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

Adds a document to this index.

  • access: public
void addDocument (Zend_Search_Lucene_Document $document)

Implementation of:
Zend_Search_Lucene_Interface::addDocument()
Adds a document to this index.
close (line 255)

Close current index and free resources

  • access: public
void close ()

Implementation of:
Zend_Search_Lucene_Interface::close()
Close current index and free resources
commit (line 977)

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

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

Implementation of:
Zend_Search_Lucene_Interface::commit()
Commit changes resulting from delete() or undeleteAll() operations.
count (line 313)

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

  • access: public
integer count ()

Implementation of:
Zend_Search_Lucene_Interface::count()
Returns the total number of documents in this index (including deleted documents).
delete (line 923)

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)

Implementation of:
Zend_Search_Lucene_Interface::delete()
Deletes a document from the index.
docFreq (line 845)

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

  • access: public
integer docFreq (Zend_Search_Lucene_Index_Term $term)

Implementation of:
Zend_Search_Lucene_Interface::docFreq()
Returns the number of documents in this index containing the $term.
find (line 514)

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

Implementation of:
Zend_Search_Lucene_Interface::find()
Performs a query against the index and returns an array of Zend_Search_Lucene_Search_QueryHit objects.
getDirectory (line 302)

Returns the Zend_Search_Lucene_Storage_Directory instance for this index.

  • access: public

Implementation of:
Zend_Search_Lucene_Interface::getDirectory()
Returns the Zend_Search_Lucene_Storage_Directory instance for this index.
getDocument (line 663)

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

  • access: public

Implementation of:
Zend_Search_Lucene_Interface::getDocument()
Returns a Zend_Search_Lucene_Document object for the document number $id in this index.
getFieldNames (line 646)

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

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

Implementation of:
Zend_Search_Lucene_Interface::getFieldNames()
Returns a list of all unique field names that exist in this index.
getIndexWriter (line 287)

Returns an instance of Zend_Search_Lucene_Index_Writer for the index

  • access: public
getMaxBufferedDocs (line 407)

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

Implementation of:
Zend_Search_Lucene_Interface::getMaxBufferedDocs()
Retrieve index maxBufferedDocs option
getMaxMergeDocs (line 439)

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

Implementation of:
Zend_Search_Lucene_Interface::getMaxMergeDocs()
Retrieve index maxMergeDocs option
getMergeFactor (line 478)

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

Implementation of:
Zend_Search_Lucene_Interface::getMergeFactor()
Retrieve index mergeFactor option
getSimilarity (line 864)

Retrive similarity used by index reader

  • access: public

Implementation of:
Zend_Search_Lucene_Interface::getSimilarity()
Retrive similarity used by index reader
hasDeletions (line 904)

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

  • access: public
boolean hasDeletions ()

Implementation of:
Zend_Search_Lucene_Interface::hasDeletions()
Returns true if any documents have been deleted from this index.
hasTerm (line 730)

Returns true if index contain documents with specified term.

Is used for query optimization.

  • access: public
boolean hasTerm (Zend_Search_Lucene_Index_Term $term)

Implementation of:
Zend_Search_Lucene_Interface::hasTerm()
Returns true if index contain documents with specified term.
isDeleted (line 353)

Checks, that document is deleted

  • access: public
  • throws: Zend_Search_Lucene_Exception Exception is thrown if $id is out of the range
boolean isDeleted (integer $id)
  • integer $id

Implementation of:
Zend_Search_Lucene_Interface::isDeleted()
Checks, that document is deleted
maxDoc (line 325)

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

Implementation of:
Zend_Search_Lucene_Interface::maxDoc()
Returns one greater than the largest possible document number.
norm (line 877)

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

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

Implementation of:
Zend_Search_Lucene_Interface::norm()
Returns a normalization factor for "field, document" pair.
numDocs (line 335)

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

  • access: public
integer numDocs ()

Implementation of:
Zend_Search_Lucene_Interface::numDocs()
Returns the total number of non-deleted documents in this index.
optimize (line 1000)

Optimize index.

Merges all segments into one

  • access: public
void optimize ()

Implementation of:
Zend_Search_Lucene_Interface::optimize()
Optimize index.
setMaxBufferedDocs (line 422)

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

Implementation of:
Zend_Search_Lucene_Interface::setMaxBufferedDocs()
Set index maxBufferedDocs option
setMaxMergeDocs (line 456)

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

Implementation of:
Zend_Search_Lucene_Interface::setMaxMergeDocs()
Set index maxMergeDocs option
setMergeFactor (line 500)

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

Implementation of:
Zend_Search_Lucene_Interface::setMergeFactor()
Set index mergeFactor option
termDocs (line 747)

Returns IDs of all the documents containing term.

  • access: public
array termDocs (Zend_Search_Lucene_Index_Term $term)

Implementation of:
Zend_Search_Lucene_Interface::termDocs()
Returns IDs of all the documents containing term.
termPositions (line 790)

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)

Implementation of:
Zend_Search_Lucene_Interface::termPositions()
Returns an array of all term positions in the documents.
terms (line 1017)

Returns an array of all terms in this index.

  • access: public
array terms ()

Implementation of:
Zend_Search_Lucene_Interface::terms()
Returns an array of all terms in this index.
undeleteAll (line 1060)

Undeletes all documents currently marked as deleted in this index.

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

Implementation of:
Zend_Search_Lucene_Interface::undeleteAll()
Undeletes all documents currently marked as deleted in this index.

Documentation generated on Fri, 06 Apr 2007 18:26:08 -0700 by phpDocumentor 1.3.1