Zend Framework  1.12
Public Member Functions | Protected Member Functions | List of all members
Zend_Search_Lucene_Search_Query_MultiTerm Class Reference

Public Member Functions

 __construct ($terms=null, $signs=null)
 Class constructor.
 
 addTerm (Zend_Search_Lucene_Index_Term $term, $sign=null)
 Add a $term (Zend_Search_Lucene_Index_Term) to this query.
 
 rewrite (Zend_Search_Lucene_Interface $index)
 Re-write query into primitive queries in the context of specified index.
 
 optimize (Zend_Search_Lucene_Interface $index)
 Optimize query in the context of specified index.
 
 getTerms ()
 Returns query term.
 
 getSigns ()
 Return terms signs.
 
 setWeight ($num, $weight)
 Set weight for specified term.
 
 createWeight (Zend_Search_Lucene_Interface $reader)
 Constructs an appropriate Weight implementation for this query.
 
 _conjunctionScore ($docId, Zend_Search_Lucene_Interface $reader)
 Score calculator for conjunction queries (all terms are required)
 
 _nonConjunctionScore ($docId, $reader)
 Score calculator for non conjunction queries (not all terms are required)
 
 execute (Zend_Search_Lucene_Interface $reader, $docsFilter=null)
 Execute query in context of index reader It also initializes necessary internal structures.
 
 matchedDocs ()
 Get document ids likely matching the query.
 
 score ($docId, Zend_Search_Lucene_Interface $reader)
 Score specified document.
 
 getQueryTerms ()
 Return query terms.
 
 __toString ()
 Print a query.
 
- Public Member Functions inherited from Zend_Search_Lucene_Search_Query
 getBoost ()
 Gets the boost for this clause.
 
 setBoost ($boost)
 Sets the boost for this query clause to $boost.
 
 score ($docId, Zend_Search_Lucene_Interface $reader)
 Score specified document.
 
 matchedDocs ()
 Get document ids likely matching the query.
 
 execute (Zend_Search_Lucene_Interface $reader, $docsFilter=null)
 Execute query in context of index reader It also initializes necessary internal structures.
 
 createWeight (Zend_Search_Lucene_Interface $reader)
 Constructs an appropriate Weight implementation for this query.
 
 rewrite (Zend_Search_Lucene_Interface $index)
 Re-write query into primitive queries in the context of specified index.
 
 optimize (Zend_Search_Lucene_Interface $index)
 Optimize query in the context of specified index.
 
 reset ()
 Reset query, so it can be reused within other queries or with other indeces.
 
 __toString ()
 Print a query.
 
 getQueryTerms ()
 Return query terms.
 
 highlightMatches ($inputHTML, $defaultEncoding= '', $highlighter=null)
 Highlight matches in $inputHTML.
 
 htmlFragmentHighlightMatches ($inputHtmlFragment, $encoding= 'UTF-8', $highlighter=null)
 Highlight matches in $inputHtmlFragment and return it (without HTML header and body tag)
 

Protected Member Functions

 _highlightMatches (Zend_Search_Lucene_Search_Highlighter_Interface $highlighter)
 Query specific matches highlighting.
 
- Protected Member Functions inherited from Zend_Search_Lucene_Search_Query
 _initWeight (Zend_Search_Lucene_Interface $reader)
 Constructs an initializes a Weight for a _top-level_query_.
 
 _highlightMatches (Zend_Search_Lucene_Search_Highlighter_Interface $highlighter)
 Query specific matches highlighting.
 

Additional Inherited Members

- Protected Attributes inherited from Zend_Search_Lucene_Search_Query
 $_weight = null
 

Constructor & Destructor Documentation

__construct (   $terms = null,
  $signs = null 
)

Class constructor.

Create a new multi-term query object.

if $signs array is omitted then all terms are required it differs from addTerm() behavior, but should never be used

Parameters
array$termsArray of Zend_Search_Lucene_Index_Term objects
array$signsArray of signs. Sign is boolean|null.
Exceptions
Zend_Search_Lucene_Exception

Member Function Documentation

__toString ( )

Print a query.

Returns
string
_conjunctionScore (   $docId,
Zend_Search_Lucene_Interface  $reader 
)

Score calculator for conjunction queries (all terms are required)

Parameters
integer$docId
Zend_Search_Lucene_Interface$reader
Returns
float

We don't need to check that term freq is not 0 Score calculation is performed only for matched docs

_highlightMatches ( Zend_Search_Lucene_Search_Highlighter_Interface  $highlighter)
protected

Query specific matches highlighting.

Parameters
Zend_Search_Lucene_Search_Highlighter_Interface$highlighterHighlighter object (also contains doc for highlighting)
_nonConjunctionScore (   $docId,
  $reader 
)

Score calculator for non conjunction queries (not all terms are required)

Parameters
integer$docId
Zend_Search_Lucene_Interface$reader
Returns
float

We don't need to check that term freq is not 0 Score calculation is performed only for matched docs

addTerm ( Zend_Search_Lucene_Index_Term  $term,
  $sign = null 
)

Add a $term (Zend_Search_Lucene_Index_Term) to this query.

The sign is specified as: TRUE - term is required FALSE - term is prohibited NULL - term is neither prohibited, nor required

Parameters
Zend_Search_Lucene_Index_Term$term
boolean | null$sign
Returns
void
createWeight ( Zend_Search_Lucene_Interface  $reader)

Constructs an appropriate Weight implementation for this query.

Parameters
Zend_Search_Lucene_Interface$reader
Returns
Zend_Search_Lucene_Search_Weight
execute ( Zend_Search_Lucene_Interface  $reader,
  $docsFilter = null 
)

Execute query in context of index reader It also initializes necessary internal structures.

Parameters
Zend_Search_Lucene_Interface$reader
Zend_Search_Lucene_Index_DocsFilter | null$docsFilter
getQueryTerms ( )

Return query terms.

Returns
array
getSigns ( )

Return terms signs.

Returns
array
getTerms ( )

Returns query term.

Returns
array
matchedDocs ( )

Get document ids likely matching the query.

It's an array with document ids as keys (performance considerations)

Returns
array
optimize ( Zend_Search_Lucene_Interface  $index)

Optimize query in the context of specified index.

Parameters
Zend_Search_Lucene_Interface$index
Returns
Zend_Search_Lucene_Search_Query
Todo:
make an optimization for repeated terms (they may have different signs)
rewrite ( Zend_Search_Lucene_Interface  $index)

Re-write query into primitive queries in the context of specified index.

Parameters
Zend_Search_Lucene_Interface$index
Returns
Zend_Search_Lucene_Search_Query

transform multiterm query to boolean and apply rewrite() method to subqueries.

score (   $docId,
Zend_Search_Lucene_Interface  $reader 
)

Score specified document.

Parameters
integer$docId
Zend_Search_Lucene_Interface$reader
Returns
float
setWeight (   $num,
  $weight 
)

Set weight for specified term.

Parameters
integer$num
Zend_Search_Lucene_Search_Weight_Term$weight