QueryGroup
extends AbstractQuery
in package
A group of single/simples queries, joined by boolean operator.
Tags
Table of Contents
- $negation : bool
- Is the query group negated?
- $operator : string
- Boolean operator.
- $operators : array<string|int, mixed>
- Valid boolean operators.
- $queries : array<string|int, mixed>
- Queries.
- $reducedHandler : string
- Name of the handler to be used if the query group is reduced.
- __clone() : void
- Copy constructor
- __construct() : void
- Constructor.
- addQueries() : void
- Add group queries.
- addQuery() : void
- Add a query to the group.
- containsTerm() : bool
- Does the query contain the specified term? An optional normalizer can be provided to allow for fuzzier matching.
- getAllTerms() : string
- Get a concatenated list of all query strings within the object.
- getOperator() : string
- Return boolean operator.
- getQueries() : array<string|int, mixed>
- Return group queries.
- getReducedHandler() : string|null
- Return name of reduced handler.
- isNegated() : bool
- Return true if group is an exclusion group.
- replaceTerm() : void
- Replace a term.
- setOperator() : void
- Set boolean operator.
- setQueries() : void
- Set group queries.
- setReducedHandler() : void
- Set name of reduced handler.
- unsetReducedHandler() : void
- Unset reduced handler.
Properties
$negation
Is the query group negated?
protected
bool
$negation
$operator
Boolean operator.
protected
string
$operator
$operators
Valid boolean operators.
protected
static array<string|int, mixed>
$operators
= ['AND', 'OR', 'NOT']
$queries
Queries.
protected
array<string|int, mixed>
$queries
$reducedHandler
Name of the handler to be used if the query group is reduced.
protected
string
$reducedHandler
Tags
Methods
__clone()
Copy constructor
public
__clone() : void
Return values
void —__construct()
Constructor.
public
__construct(string $operator[, array<string|int, mixed> $queries = [] ][, string $reducedHandler = null ]) : void
Parameters
- $operator : string
-
Boolean operator
- $queries : array<string|int, mixed> = []
-
Queries
- $reducedHandler : string = null
-
Handler to be uses if reduced
Return values
void —addQueries()
Add group queries.
public
addQueries(array<string|int, mixed> $queries) : void
Parameters
- $queries : array<string|int, mixed>
-
Group queries
Return values
void —addQuery()
Add a query to the group.
public
addQuery(AbstractQuery $query) : void
Parameters
- $query : AbstractQuery
-
Query to add
Return values
void —containsTerm()
Does the query contain the specified term? An optional normalizer can be provided to allow for fuzzier matching.
public
containsTerm(string $needle[, callable $normalizer = null ]) : bool
Parameters
- $needle : string
-
Term to check
- $normalizer : callable = null
-
Function to normalize text strings (null for no normalization)
Return values
bool —getAllTerms()
Get a concatenated list of all query strings within the object.
public
getAllTerms() : string
Return values
string —getOperator()
Return boolean operator.
public
getOperator() : string
Return values
string —getQueries()
Return group queries.
public
getQueries() : array<string|int, mixed>
Return values
array<string|int, mixed> —getReducedHandler()
Return name of reduced handler.
public
getReducedHandler() : string|null
Return values
string|null —isNegated()
Return true if group is an exclusion group.
public
isNegated() : bool
Return values
bool —replaceTerm()
Replace a term.
public
replaceTerm(string $from, string $to[, callable $normalizer = null ]) : void
Parameters
- $from : string
-
Search term to find
- $to : string
-
Search term to insert
- $normalizer : callable = null
-
Function to normalize text strings (null for no normalization)
Return values
void —setOperator()
Set boolean operator.
public
setOperator(string $operator) : void
Parameters
- $operator : string
-
Boolean operator
Tags
Return values
void —setQueries()
Set group queries.
public
setQueries(array<string|int, mixed> $queries) : void
Parameters
- $queries : array<string|int, mixed>
-
Group queries
Return values
void —setReducedHandler()
Set name of reduced handler.
public
setReducedHandler(string $handler) : void
Parameters
- $handler : string
-
Reduced handler
Return values
void —unsetReducedHandler()
Unset reduced handler.
public
unsetReducedHandler() : void