Copied!

FullText

FullText.php : 50
Extends Criterion

Full text search criterion.

The string provided in this criterion is matched as a full text query against all indexed content objects in the storage layer.

Normalization and querying capabilities might depend on the system configuration or the used search engine and might differ. To find about supported querying capabilities you can use SearchService::supports() method.

If supported, advanced full text query has the following semantics:

  • If multiple words are specified an OR query is performed.
  • Boolean operators are supported: AND (&&), OR (||), NOT (!).
  • Required/prohibit operators are supported: +, -.
  • Grouping is supported through parentheses.
  • Phrases are supported using double quotes.
  • Simple wild cards are supported. If an asterisk (*) is used at the end or beginning of a word this is translated into a wild card query. Thus "fo*" would match "foo" and "foobar", for example.
  • Advanced language analysis (like stemming, synonym expansion and stop word removal) might be applied to the words provided in the query.

If advanced full text query is not supported, basic query format will be available:

  • If multiple words are specified an AND query is performed. OR queries are not supported.
  • Simple wild cards are supported. If an asterisk () is used at the end or beginning of a word this is translated into a wild card query. Thus "fo" would match "foo" and "foobar", for example.
  • Simple stop word removal might be applied to the words provided in the query.

Properties

public $analyzers

FullText.php : 85

Analyzer configuration.

public mixed $analyzers
Tags
Todo:

Define how this could look like

public $boost

FullText.php : 76

Boost for certain fields.

public array<string|int, mixed> $boost = []

Array of boosts to apply for certain fields – the array should look like this:

array( 'title' => 2, … )

public $fuzziness

FullText.php : 59

Fuzziness of the fulltext search.

public float $fuzziness = 1.0

May be a value between 0. (fuzzy) and 1. (sharp).

public $operator

Criterion.php : 23

The operator used by the Criterion.

public string $operator

public $target

Criterion.php : 37

The target used by the criteria (field, metadata...).

public string $target

public $value

Criterion.php : 30

The value(s) matched by the criteria.

public array<string|int, scalar>|scalar $value

public $valueData

Criterion.php : 44

Additional value data, required by some criterions, MapLocationDistance for instance.

public Value $valueData

public $wildcards

FullText.php : 94

Analyzer wildcard handling configuration.

public mixed $wildcards
Tags
Todo:

Define how this could look like

protected $customFields

FullText.php : 101

Custom field definitions to query instead of default field.

protected array<string|int, mixed> $customFields = []

Methods

public__construct()

FullText.php : 103

Performs operator validation based on the Criterion specifications returned by {@see getSpecifications()}.

public __construct(mixed $value[, array<string|int, mixed> $properties = [] ])

Parameters

Name Type Default value Description
$value mixed - -
$properties array<string|int, mixed> [] -

publicgetCustomField()

FullText.php : 149

Retun custom field.

public getCustomField(string $type, string $field) : mixed

If no custom field is set, return null

Parameters

Name Type Default value Description
$type string - -
$field string - -

publicgetSpecifications()

FullText.php : 118

Criterion description function.

public getSpecifications() : array<string|int, Specifications>

Returns the combination of the Criterion's supported operator/value, as an array of Specifications objects

  • Operator is one supported Operator, as an Operator::* constant
  • ValueType is the type of input value this operator requires, either array or single
  • SupportedTypes is an array of types the operator will accept
  • ValueCountLimitation is an integer saying how many values are expected.
// IN and EQ are supported return [ // The EQ operator expects a single value, either as an integer or a string new Specifications( Operator::EQ, Specifications::FORMAT_SINGLE, Specifications::TYPE_INTEGER | Specifications::TYPE_STRING ), // The IN operator expects an array of values, of either integers or strings new Specifications( Operator::IN, Specifications::FORMAT_ARRAY, Specifications::TYPE_INTEGER | Specifications::TYPE_STRING ) ]

Return values

array<string|int, Specifications>

publicsetCustomField()

FullText.php : 134

Set a custom field to query.

public setCustomField(string $type, string $field, string $customField) : void

Set a custom field to query for a defined field in a defined type.

Parameters

Name Type Default value Description
$type string - -
$field string - -
$customField string - -