Documentation

SearchConfig
in package

Stores the repository search configuration, e.g. full text search options and pagination options.

Tags
author

zozlak

Table of Contents

Constants

FTS_BINARY  = 'BINARY'

Properties

$class  : string|null
An optional class of the for the objects returned as the search results (to be used by extension libraries).
$count  : int|null
Total number of resources matching the search (despite limit/offset)
$ftsFragmentDelimiter  : string|null
Full text search highlighting options see - https://www.postgresql.org/docs/current/textsearch-controls.html#TEXTSEARCH-HEADLINE
$ftsHighlightAll  : bool|null
Full text search highlighting options see - https://www.postgresql.org/docs/current/textsearch-controls.html#TEXTSEARCH-HEADLINE
$ftsMaxFragments  : int|null
Full text search highlighting options see - https://www.postgresql.org/docs/current/textsearch-controls.html#TEXTSEARCH-HEADLINE
$ftsMaxWords  : int|null
Full text search highlighting options see - https://www.postgresql.org/docs/current/textsearch-controls.html#TEXTSEARCH-HEADLINE
$ftsMinWords  : int|null
Full text search highlighting options see - https://www.postgresql.org/docs/current/textsearch-controls.html#TEXTSEARCH-HEADLINE
$ftsProperty  : string|null
Data to be used for full text search results highlighting.
$ftsQuery  : string|null
A full text search query used for search results highlighting.
$ftsShortWord  : int|null
Full text search highlighting options see - https://www.postgresql.org/docs/current/textsearch-controls.html#TEXTSEARCH-HEADLINE
$ftsStartSel  : string|null
Full text search highlighting options see - https://www.postgresql.org/docs/current/textsearch-controls.html#TEXTSEARCH-HEADLINE
$ftsStopSel  : string|null
Full text search highlighting options see - https://www.postgresql.org/docs/current/textsearch-controls.html#TEXTSEARCH-HEADLINE
$limit  : int|null
Maximum number of returned resources (only resources matched by the search are counted - see `$metadataMode`).
$metadataMode  : string|null
Controls amount of metadata included in the search results.
$metadataParentProperty  : string|null
RDF predicate used by some of metadataModes.
$offset  : int|null
Offset of the first returned result.
$orderBy  : array<string|int, string>
List of metadata properties to order results by.
$orderByCollation  : string|null
If specified, determines the collation used for ordering the search results.
$orderByLang  : string|null
If specified, only property values with a given language are taken into account for ordering search matches.
$relativesProperties  : array<string|int, string>
List of metadata properties to fetch for relative-according-to-metadata-read-mode resources.
$resourceProperties  : array<string|int, string>
List of metadata properties to fetch for the resource.
$skipArtificialProperties  : bool
Should artificially generated search properties denoting search match, ordering, FTS highlighting, etc. be skipped or included.

Methods

factory()  : SearchConfig
Creates an instance of the SearchConfig class from the POST data or given array.
getHeaders()  : array<string|int, string>
Returns HTTP request headers setting metadata read mode and metadata parent property according to the search config settings.
toArray()  : array<string|int, mixed>
toQuery()  : string

Constants

Properties

$class

An optional class of the for the objects returned as the search results (to be used by extension libraries).

public string|null $class = null

$count

Total number of resources matching the search (despite limit/offset)

public int|null $count = null

Set by RepoInterface::getGraphBy*() and RepoInterface::getResourceBy*() methods.

$ftsFragmentDelimiter

Full text search highlighting options see - https://www.postgresql.org/docs/current/textsearch-controls.html#TEXTSEARCH-HEADLINE

public string|null $ftsFragmentDelimiter = null

$ftsHighlightAll

Full text search highlighting options see - https://www.postgresql.org/docs/current/textsearch-controls.html#TEXTSEARCH-HEADLINE

public bool|null $ftsHighlightAll = null

$ftsMaxFragments

Full text search highlighting options see - https://www.postgresql.org/docs/current/textsearch-controls.html#TEXTSEARCH-HEADLINE

public int|null $ftsMaxFragments = null

$ftsMaxWords

Full text search highlighting options see - https://www.postgresql.org/docs/current/textsearch-controls.html#TEXTSEARCH-HEADLINE

public int|null $ftsMaxWords = null

$ftsMinWords

Full text search highlighting options see - https://www.postgresql.org/docs/current/textsearch-controls.html#TEXTSEARCH-HEADLINE

public int|null $ftsMinWords = null

$ftsProperty

Data to be used for full text search results highlighting.

public string|null $ftsProperty = null
  • null if both resource metadata and binary content should be used;
  • an RDF property if a given metadata property should be used
  • SearchConfig::FTS_BINARY if the resource binary content should be used

$ftsQuery

A full text search query used for search results highlighting.

public string|null $ftsQuery = null

See https://www.postgresql.org/docs/current/textsearch-controls.html#TEXTSEARCH-PARSING-QUERIES and the websearch_to_tsquery() function documentation.

Remember this query is applied only to the search results and is not used to perform an actual search (yes, technically you can search by one term and highlight results using the other).

$ftsShortWord

Full text search highlighting options see - https://www.postgresql.org/docs/current/textsearch-controls.html#TEXTSEARCH-HEADLINE

public int|null $ftsShortWord = null

$ftsStartSel

Full text search highlighting options see - https://www.postgresql.org/docs/current/textsearch-controls.html#TEXTSEARCH-HEADLINE

public string|null $ftsStartSel = null

$ftsStopSel

Full text search highlighting options see - https://www.postgresql.org/docs/current/textsearch-controls.html#TEXTSEARCH-HEADLINE

public string|null $ftsStopSel = null

$limit

Maximum number of returned resources (only resources matched by the search are counted - see `$metadataMode`).

public int|null $limit = null

$metadataParentProperty

RDF predicate used by some of metadataModes.

public string|null $metadataParentProperty = null

$offset

Offset of the first returned result.

public int|null $offset = null

Remember your search results must be ordered if you want get stable results.

$orderBy

List of metadata properties to order results by.

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

Only literal values are used for ordering.

$orderByCollation

If specified, determines the collation used for ordering the search results.

public string|null $orderByCollation = null

The collation must be available for the underlying database.

$orderByLang

If specified, only property values with a given language are taken into account for ordering search matches.

public string|null $orderByLang = null

$relativesProperties

List of metadata properties to fetch for relative-according-to-metadata-read-mode resources.

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

If empty, all properties are fetched.

$resourceProperties

List of metadata properties to fetch for the resource.

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

If empty, all properties are fetched.

Doesn't affect technical properties generated by the search.

$skipArtificialProperties

Should artificially generated search properties denoting search match, ordering, FTS highlighting, etc. be skipped or included.

public bool $skipArtificialProperties = false

Methods

factory()

Creates an instance of the SearchConfig class from the POST data or given array.

public static factory([array<string, string> $src = null ]) : SearchConfig
Parameters
$src : array<string, string> = null

source array. If not provided, $_POST is used instead.

Return values
SearchConfig

getHeaders()

Returns HTTP request headers setting metadata read mode and metadata parent property according to the search config settings.

public getHeaders(Repo $repo) : array<string|int, string>
Parameters
$repo : Repo
Return values
array<string|int, string>

toArray()

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

toQuery()

public toQuery() : string
Return values
string

        
On this page

Search results