Class Zend_Search_Lucene_Search_Query_Phrase

Description

A Query that matches documents containing a particular sequence of terms.

Located in /Zend/Search/Lucene/Search/Query/Phrase.php (line 41)

Zend_Search_Lucene_Search_Query
   |
   --Zend_Search_Lucene_Search_Query_Phrase
Variable Summary
 array $_offsets
 mixed $_resVector
 unknown_type $_slop
 array $_terms
Method Summary
 Zend_Search_Lucene_Search_Query_Phrase __construct ([array $terms = null], [array $offsets = null], [string $field = null])
 void addTerm (Zend_Search_Lucene_Index_Term $term, [integer $position = null])
 integer getSlop ()
 array getTerms ()
 float score (integer $docId, Zend_Search_Lucene $reader)
 void setSlop (integer $slop)
 void setWeight (integer $num, Zend_Search_Lucene_Search_Weight_Term $weight)
 float _exactPhraseFreq (integer $docId)
 float _sloppyPhraseFreq (integer $docId, Zend_Search_Lucene $reader)
Variables
array $_offsets (line 57)

Term positions (relative positions of terms within the phrase).

Array of integers

  • access: private
mixed $_resVector = null (line 85)

Result vector.

Bitset or array of document IDs (depending from Bitset extension availability).

  • access: private
unknown_type $_slop (line 76)

Sets the number of other words permitted between words in query phrase.

If zero, then this is an exact phrase search. For larger values this works like a WITHIN or NEAR operator.

The slop is in fact an edit-distance, where the units correspond to moves of terms in the query phrase out of position. For example, to switch the order of two words requires two moves (the first move places the words atop one another), so to permit re-orderings of phrases, the slop must be at least two. More exact matches are scored higher than sloppier matches, thus search results are sorted by exactness.

The slop is zero by default, requiring exact matches.

  • access: private
array $_terms (line 49)

Terms to find.

Array of Zend_Search_Lucene_Index_Term objects.

  • access: private
array $_termsPositions = array() (line 95)

Terms positions vectors.

Array of Arrays: term1Id => (docId => array( pos1, pos2, ... ), ...) term2Id => (docId => array( pos1, pos2, ... ), ...)

  • access: private

Inherited Variables

Inherited from Zend_Search_Lucene_Search_Query

Zend_Search_Lucene_Search_Query::$_boost
Zend_Search_Lucene_Search_Query::$_weight
Methods
Constructor __construct (line 105)

Class constructor. Create a new prase query.

  • access: public
  • throws: Zend_Search_Lucene_Exception
Zend_Search_Lucene_Search_Query_Phrase __construct ([array $terms = null], [array $offsets = null], [string $field = null])
  • string $field: Field to search.
  • array $terms: Terms to search Array of strings.
  • array $offsets: Relative term positions. Array of integers.
addTerm (line 167)

Adds a term to the end of the query phrase.

The relative position of the term is specified explicitly or the one immediately after the last term added.

  • access: public
void addTerm (Zend_Search_Lucene_Index_Term $term, [integer $position = null])
getSlop (line 153)

Get slop

  • access: public
integer getSlop ()
getTerms (line 189)

Returns query term

  • access: public
array getTerms ()
score (line 386)

Score specified document

  • access: public
float score (integer $docId, Zend_Search_Lucene $reader)

Redefinition of:
Zend_Search_Lucene_Search_Query::score()
Score specified document
setSlop (line 142)

Set slop

  • access: public
void setSlop (integer $slop)
  • integer $slop
setWeight (line 201)

Set weight for specified term

  • access: public
void setWeight (integer $num, Zend_Search_Lucene_Search_Weight_Term $weight)
_calculateResult (line 224)

Calculate result vector

  • access: private
void _calculateResult (Zend_Search_Lucene $reader)
_createWeight (line 213)

Constructs an appropriate Weight implementation for this query.

  • access: protected

Redefinition of:
Zend_Search_Lucene_Search_Query::_createWeight()
Constructs an appropriate Weight implementation for this query.
_exactPhraseFreq (line 263)

Score calculator for exact phrase queries (terms sequence is fixed)

  • access: public
float _exactPhraseFreq (integer $docId)
  • integer $docId
_sloppyPhraseFreq (line 309)

Score calculator for sloppy phrase queries (terms sequence is fixed)

  • access: public
float _sloppyPhraseFreq (integer $docId, Zend_Search_Lucene $reader)

Inherited Methods

Inherited From Zend_Search_Lucene_Search_Query

 Zend_Search_Lucene_Search_Query::getBoost()
 Zend_Search_Lucene_Search_Query::score()
 Zend_Search_Lucene_Search_Query::setBoost()
 Zend_Search_Lucene_Search_Query::_createWeight()
 Zend_Search_Lucene_Search_Query::_initWeight()

Documentation generated on Tue, 18 Apr 2006 11:55:28 -0700 by phpDocumentor 1.3.0RC3