class search_metadata_criteria

internal  
 

Filtering criteria for Item metadata.

Used by the Query Builder to construct JOINs and WHERE clauses on the metadata table.

Metadata search criteria for Item Search Engine.

Supports multiple conditions on the same metadata key.

Examples:

$criteria->where('price', operator::GTE, 100); $criteria->where('price', operator::LTE, 200);

// expiration >= time() $criteria->where('expiration', operator::GTE, time());

// metadata IN (...) $criteria->where_in('level', [1, 2, 3]);

// metadata LIKE $criteria->where('category', operator::LIKE, '%premium%');

// raw SQL (rare cases) $criteria->raw('custom_key', 'meta1.meta_value = course.id');

Properties

array $filters

Methods

where(string $key, operator $op, mixed $value, mixed $value2 = null)

Add a metadata condition.

where_in(string $key, array $values)

WHERE IN (metadata).

where_not_in(string $key, array $values)

WHERE NOT IN (metadata).

raw(string $key, string $sql)

Raw SQL condition for metadata (advanced use).

bool
has_filters()

Check if there are any metadata filters defined.

Details

at line 84
search_metadata_criteria where(string $key, operator $op, mixed $value, mixed $value2 = null)

Add a metadata condition.

Parameters

string $key

Metadata key name

operator $op

Comparison operator

mixed $value

Primary value

mixed $value2

Optional secondary value

Return Value

search_metadata_criteria

at line 99
search_metadata_criteria where_in(string $key, array $values)

WHERE IN (metadata).

Parameters

string $key
array $values

Return Value

search_metadata_criteria

at line 114
search_metadata_criteria where_not_in(string $key, array $values)

WHERE NOT IN (metadata).

Parameters

string $key
array $values

Return Value

search_metadata_criteria

at line 129
search_metadata_criteria raw(string $key, string $sql)

Raw SQL condition for metadata (advanced use).

Parameters

string $key
string $sql

Return Value

search_metadata_criteria

at line 144
bool has_filters()

Check if there are any metadata filters defined.

Return Value

bool