Boolean
extends AbstractQuery
in package
Tags
Table of Contents
Properties
- $_weight : AbstractWeight
- AbstractQuery weight
- $_boost : float
- query boost factor
- $_coord : mixed
- A score factor based on the fraction of all query subqueries that a document contains.
- $_resVector : array<string|int, mixed>
- Result vector.
- $_signs : array<string|int, mixed>
- Subqueries signs.
- $_subqueries : array<string|int, mixed>
- Subqueries Array of Zend_Search_Lucene_Search_Query
Methods
- __construct() : void
- Class constructor. Create a new Boolean query object.
- __toString() : string
- Print a query
- _conjunctionScore() : float
- Score calculator for conjunction queries (all subqueries are required)
- _nonConjunctionScore() : float
- Score calculator for non conjunction queries (not all subqueries are required)
- addSubquery() : void
- Add a $subquery (Zend_Search_Lucene_Search_Query) to this query.
- createWeight() : Boolean
- Constructs an appropriate Weight implementation for this query.
- execute() : void
- Execute query in context of index reader It also initializes necessary internal structures
- getBoost() : float
- Gets the boost for this clause. Documents matching this clause will (in addition to the normal weightings) have their score multiplied by boost. The boost is 1.0 by default.
- getQueryTerms() : array<string|int, mixed>
- Return query terms
- getSigns() : array<string|int, mixed>
- Return subqueries signs
- getSubqueries() : array<string|int, mixed>
- Returns subqueries
- highlightMatches() : string
- Highlight matches in $inputHTML
- htmlFragmentHighlightMatches() : string
- Highlight matches in $inputHTMLFragment and return it (without HTML header and body tag)
- matchedDocs() : array<string|int, mixed>
- Get document ids likely matching the query
- optimize() : AbstractQuery
- Optimize query in the context of specified index
- reset() : void
- Reset query, so it can be reused within other queries or with other indeces
- rewrite() : AbstractQuery
- Re-write queries into primitive queries
- score() : float
- Score specified document
- setBoost() : void
- Sets the boost for this query clause to $boost.
- _highlightMatches() : void
- Query specific matches highlighting
- _initWeight() : AbstractWeight|null
- Constructs an initializes a Weight for a _top-level_query_.
- _calculateConjunctionResult() : void
- Calculate result vector for Conjunction query (like '<subquery1> AND <subquery2> AND <subquery3>')
- _calculateNonConjunctionResult() : void
- Calculate result vector for non Conjunction query (like '<subquery1> AND <subquery2> AND NOT <subquery3> OR <subquery4>')
Properties
$_weight
AbstractQuery weight
protected
AbstractWeight
$_weight
= null
$_boost
query boost factor
private
float
$_boost
= 1
$_coord
A score factor based on the fraction of all query subqueries that a document contains.
private
mixed
$_coord
= null
float for conjunction queries array of float for non conjunction queries
$_resVector
Result vector.
private
array<string|int, mixed>
$_resVector
= null
$_signs
Subqueries signs.
private
array<string|int, mixed>
$_signs
= array()
If true then subquery is required. If false then subquery is prohibited. If null then subquery is neither prohibited, nor required
If array is null then all subqueries are required
$_subqueries
Subqueries Array of Zend_Search_Lucene_Search_Query
private
array<string|int, mixed>
$_subqueries
= array()
Methods
__construct()
Class constructor. Create a new Boolean query object.
public
__construct([array<string|int, mixed> $subqueries = null ][, array<string|int, mixed> $signs = null ]) : void
if $signs array is omitted then all subqueries are required it differs from addSubquery() behavior, but should never be used
Parameters
- $subqueries : array<string|int, mixed> = null
-
Array of Zend_Search_Search_Query objects
- $signs : array<string|int, mixed> = null
-
Array of signs. Sign is boolean|null.
__toString()
Print a query
public
__toString() : string
Return values
string_conjunctionScore()
Score calculator for conjunction queries (all subqueries are required)
public
_conjunctionScore(int $docId, SearchIndexInterface $reader) : float
Parameters
- $docId : int
- $reader : SearchIndexInterface
Return values
float_nonConjunctionScore()
Score calculator for non conjunction queries (not all subqueries are required)
public
_nonConjunctionScore(int $docId, SearchIndexInterface $reader) : float
Parameters
- $docId : int
- $reader : SearchIndexInterface
Return values
floataddSubquery()
Add a $subquery (Zend_Search_Lucene_Search_Query) to this query.
public
addSubquery(AbstractQuery $subquery[, bool|null $sign = null ]) : void
The sign is specified as: TRUE - subquery is required FALSE - subquery is prohibited NULL - subquery is neither prohibited, nor required
Parameters
- $subquery : AbstractQuery
- $sign : bool|null = null
createWeight()
Constructs an appropriate Weight implementation for this query.
public
createWeight(SearchIndexInterface $reader) : Boolean
Parameters
- $reader : SearchIndexInterface
Return values
Booleanexecute()
Execute query in context of index reader It also initializes necessary internal structures
public
execute(SearchIndexInterface $reader[, DocsFilter|null $docsFilter = null ]) : void
Parameters
- $reader : SearchIndexInterface
- $docsFilter : DocsFilter|null = null
getBoost()
Gets the boost for this clause. Documents matching this clause will (in addition to the normal weightings) have their score multiplied by boost. The boost is 1.0 by default.
public
getBoost() : float
Return values
floatgetQueryTerms()
Return query terms
public
getQueryTerms() : array<string|int, mixed>
Return values
array<string|int, mixed>getSigns()
Return subqueries signs
public
getSigns() : array<string|int, mixed>
Return values
array<string|int, mixed>getSubqueries()
Returns subqueries
public
getSubqueries() : array<string|int, mixed>
Return values
array<string|int, mixed>highlightMatches()
Highlight matches in $inputHTML
public
highlightMatches(string $inputHTML[, string $defaultEncoding = '' ][, HighlighterInterface|null $highlighter = null ]) : string
Parameters
- $inputHTML : string
- $defaultEncoding : string = ''
-
HTML encoding, is used if it's not specified using Content-type HTTP-EQUIV meta tag.
- $highlighter : HighlighterInterface|null = null
Return values
stringhtmlFragmentHighlightMatches()
Highlight matches in $inputHTMLFragment and return it (without HTML header and body tag)
public
htmlFragmentHighlightMatches(string $inputHTMLFragment[, string $encoding = 'UTF-8' ][, HighlighterInterface|null $highlighter = null ]) : string
Parameters
- $inputHTMLFragment : string
- $encoding : string = 'UTF-8'
-
Input HTML string encoding
- $highlighter : HighlighterInterface|null = null
Return values
stringmatchedDocs()
Get document ids likely matching the query
public
matchedDocs() : array<string|int, mixed>
It's an array with document ids as keys (performance considerations)
Return values
array<string|int, mixed>optimize()
Optimize query in the context of specified index
public
optimize(SearchIndexInterface $index) : AbstractQuery
Parameters
- $index : SearchIndexInterface
Return values
AbstractQueryreset()
Reset query, so it can be reused within other queries or with other indeces
public
reset() : void
rewrite()
Re-write queries into primitive queries
public
rewrite(SearchIndexInterface $index) : AbstractQuery
Parameters
- $index : SearchIndexInterface
Return values
AbstractQueryscore()
Score specified document
public
score(int $docId, SearchIndexInterface $reader) : float
Parameters
- $docId : int
- $reader : SearchIndexInterface
Return values
floatsetBoost()
Sets the boost for this query clause to $boost.
public
setBoost(float $boost) : void
Parameters
- $boost : float
_highlightMatches()
Query specific matches highlighting
protected
_highlightMatches(HighlighterInterface $highlighter) : void
Parameters
- $highlighter : HighlighterInterface
-
Highlighter object (also contains doc for highlighting)
_initWeight()
Constructs an initializes a Weight for a _top-level_query_.
protected
_initWeight(SearchIndexInterface $reader) : AbstractWeight|null
Parameters
- $reader : SearchIndexInterface
Return values
AbstractWeight|null_calculateConjunctionResult()
Calculate result vector for Conjunction query (like '<subquery1> AND <subquery2> AND <subquery3>')
private
_calculateConjunctionResult() : void
_calculateNonConjunctionResult()
Calculate result vector for non Conjunction query (like '<subquery1> AND <subquery2> AND NOT <subquery3> OR <subquery4>')
private
_calculateNonConjunctionResult() : void