HumHub Documentation (unofficial)

MultiTerm extends AbstractQuery
in package

Tags
category

Zend

subpackage

Search

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 terms that a document contains.
$_resVector  : array<string|int, mixed>
Result vector.
$_signs  : array<string|int, mixed>
Term signs.
$_terms  : array<string|int, mixed>
Terms to find.
$_termsFreqs  : array<string|int, mixed>
Terms positions vectors.
$_weights  : array<string|int, mixed>
Terms weights array of Zend_Search_Lucene_Search_Weight

Methods

__construct()  : mixed
Class constructor. Create a new multi-term query object.
__toString()  : string
Print a query
_conjunctionScore()  : float
Score calculator for conjunction queries (all terms are required)
_nonConjunctionScore()  : float
Score calculator for non conjunction queries (not all terms are required)
addTerm()  : void
Add a $term (Zend_Search_Lucene_Index_Term) to this query.
createWeight()  : MultiTerm
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 terms signs
getTerms()  : array<string|int, mixed>
Returns query term
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 query into primitive queries in the context of specified index
score()  : float
Score specified document
setBoost()  : void
Sets the boost for this query clause to $boost.
setWeight()  : void
Set weight for specified term
_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 '+something +another')
_calculateNonConjunctionResult()  : void
Calculate result vector for non Conjunction query (like '+something -another')

Properties

$_coord

A score factor based on the fraction of all query terms 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

Term signs.

private array<string|int, mixed> $_signs

If true then term is required. If false then term is prohibited. If null then term is neither prohibited, nor required

If array is null then all terms are required

$_terms

Terms to find.

private array<string|int, mixed> $_terms = array()

Array of Zend_Search_Lucene_Index_Term

$_termsFreqs

Terms positions vectors.

private array<string|int, mixed> $_termsFreqs = array()

Array of Arrays: term1Id => (docId => freq, ...) term2Id => (docId => freq, ...)

$_weights

Terms weights array of Zend_Search_Lucene_Search_Weight

private array<string|int, mixed> $_weights = array()

Methods

__construct()

Class constructor. Create a new multi-term query object.

public __construct([array<string|int, mixed> $terms = null ][, array<string|int, mixed> $signs = null ]) : mixed

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

Parameters
$terms : array<string|int, mixed> = null

Array of \ZendSearch\Lucene\Index\Term objects

$signs : array<string|int, mixed> = null

Array of signs. Sign is boolean|null.

Tags
throws
InvalidArgumentException

__toString()

Print a query

public __toString() : string
Return values
string

_nonConjunctionScore()

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

public _nonConjunctionScore(int $docId, SearchIndexInterface $reader) : float
Parameters
$docId : int
$reader : SearchIndexInterface
Return values
float

addTerm()

Add a $term (Zend_Search_Lucene_Index_Term) to this query.

public addTerm(Term $term[, bool|null $sign = null ]) : void

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

Parameters
$term : Term
$sign : bool|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
float

getQueryTerms()

Return query terms

public getQueryTerms() : array<string|int, mixed>
Return values
array<string|int, mixed>

getSigns()

Return terms signs

public getSigns() : array<string|int, mixed>
Return values
array<string|int, mixed>

getTerms()

Returns query term

public getTerms() : 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
string

htmlFragmentHighlightMatches()

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
string

matchedDocs()

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>

reset()

Reset query, so it can be reused within other queries or with other indeces

public reset() : void

setBoost()

Sets the boost for this query clause to $boost.

public setBoost(float $boost) : void
Parameters
$boost : float

setWeight()

Set weight for specified term

public setWeight(int $num, Term $weight) : void
Parameters
$num : int
$weight : Term

        
On this page

Search results