Class Zend_Search_Lucene

Description

Implements interfaces:

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

Located in /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 399)

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

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.

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

Object destructor

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

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

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

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

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

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

Deletes a document from the index.

$id is an internal document id

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

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

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

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
  • throws: Zend_Search_Lucene_Exception
  • access: public
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 309)

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

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

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

Returns an instance of Zend_Search_Lucene_Index_Writer for the index

  • access: public
getMaxBufferedDocs (line 414)

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

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

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

Retrive similarity used by index reader

  • access: public

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

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

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

Checks, that document is deleted

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

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

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

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

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

Optimize index.

Merges all segments into one

  • access: public
void optimize ()

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

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

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

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

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

Returns an array of all term freqs.

Result array structure: array(docId => freq, ...)

  • access: public
integer termFreqs (Zend_Search_Lucene_Index_Term $term)

Implementation of:
Zend_Search_Lucene_Interface::termFreqs()
Returns an array of all term freqs.
termPositions (line 817)

Returns an array of all term positions in the documents.

Result 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 1009)

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

Undeletes all documents currently marked as deleted in this index.

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

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

Documentation generated on Sun, 27 May 2007 23:25:32 -0700 by phpDocumentor 1.3.2