interface SearchMetaDataInterface

Interface SearchMetaDataInterface

This hook allows adding additional faceted filters to the search results page. To enable those filters, meta data has to be added to the search documents with \XELOS\Modules\Search\SearchIndexRecord::addMetaData().

Meta data can either be added by the module when SearchableDocumentModelInterface::onSearchIndexUpdate() is called or by using the SearchPreprocessor hook.

Methods

array|null
getAggregation()

Define a custom aggregation for the meta_data. This aggregation can be used for counts of the custom values.

array
getFields()

Returns an array of Fields which define which fields are available for filtering and which for sorting.

array
getKeys()

Returns the keys used in the index which should be displayed as faceted filters.

string
getLabelForKey(string $key)

Returns the label for the given meta data key.

string
getLabelForValue(string $key, string $value)

Returns the label for the given meta data value. Return the value if it is unchanged.

array
getSearchQuery(string $instanceId, string $key, string $value)

Returns the search query for the given key and value.

array
getValuesForKey(string $key, array $values, array $aggregation)

Enables custom values with their own counts instead of the values defined when writing to the search index.

Details

at line 76
array|null getAggregation()

Define a custom aggregation for the meta_data. This aggregation can be used for counts of the custom values.

This aggregation will be passed to getValuesForKey.

at line 29
array getFields()

Returns an array of Fields which define which fields are available for filtering and which for sorting.

Return Value

array

at line 36
array getKeys()

Returns the keys used in the index which should be displayed as faceted filters.

Return Value

array

at line 45
string getLabelForKey(string $key)

Returns the label for the given meta data key.

Parameters

string $key

Return Value

string

at line 55
string getLabelForValue(string $key, string $value)

Returns the label for the given meta data value. Return the value if it is unchanged.

Parameters

string $key
string $value

Return Value

string

at line 66
array getSearchQuery(string $instanceId, string $key, string $value)

Returns the search query for the given key and value.

Parameters

string $instanceId
string $key
string $value

Return Value

array

at line 89
array getValuesForKey(string $key, array $values, array $aggregation)

Enables custom values with their own counts instead of the values defined when writing to the search index.

Parameters

string $key

Meta Data key

array $values

Distinct values stored in the index (TOP 10)

array $aggregation

If a custom aggregation is used, the result is returned.

Return Value

array

['value1' => 'count', 'value2' => 'count2', ...]

See also

getAggregation