SearchInterface
in
Interface for classes implementing OAI-PMH resources search.
For performance reasons the search should be implemented as a single SPARQL
query gathering all data needed to generate the OAI-PMH
Good implementation takes into account search query extensions provided by
requested metadata format class. Such extension can be gathered by calling
the static method extendSearchQuery()
(see the acdhOeaw\arche\oaipmh\metadataMetadataInterface
)
on the metadata class. The metadata class is provided by the class
method
of the metadata format descriptor (see the __construct()
method).
Tags
Table of Contents
Methods
- __construct() : mixed
- Creates a search engine object.
- checkResumptionTimeout() : bool
- Checks if the timeout for resumption token generation has been reached.
- find() : void
- Performs search using given filter values.
- findResumptionToken() : string
- Reads search results based on the resumption token.
- getCount() : int
- Returns number of resources matching last search (last call of the `find()` method).
- getHeader() : HeaderData
- Provides the `HeaderData` object for a given search result.
- getMetadata() : MetadataInterface
- Provides the `MetadataInterface` object for a given search result.
- getResumptionToken() : ResumptionTokenData
- Saves the current search in a way it can be recreated from the resumption token and returns the resumption token data.
- setLogger() : void
- Sets a logger for the search object
- setMetadataFormat() : void
- Sets metadata format configuration
Methods
__construct()
Creates a search engine object.
public
__construct(SetInterface $sets, DeletedInterface $deleted, object $config, PDO $pdo) : mixed
Parameters
- $sets : SetInterface
- $deleted : DeletedInterface
- $config : object
-
configuration object
- $pdo : PDO
-
repository database connection object
checkResumptionTimeout()
Checks if the timeout for resumption token generation has been reached.
public
checkResumptionTimeout() : bool
If it is reached, returns true.
Return values
boolfind()
Performs search using given filter values.
public
find(string $id, string $from, string $until, string $set) : void
Parameters
- $id : string
-
id filter value
- $from : string
-
date from filter value
- $until : string
-
date to filter value
- $set : string
-
set filter value
findResumptionToken()
Reads search results based on the resumption token.
public
findResumptionToken(string $token) : string
Parameters
- $token : string
Return values
stringgetCount()
Returns number of resources matching last search (last call of the `find()` method).
public
getCount() : int
Return values
intgetHeader()
Provides the `HeaderData` object for a given search result.
public
getHeader(int $pos) : HeaderData
Parameters
- $pos : int
-
seach result resource index
Return values
HeaderDatagetMetadata()
Provides the `MetadataInterface` object for a given search result.
public
getMetadata(int $pos) : MetadataInterface
The exact class of the returned object is defined by the class
field
of the metadata descriptor (see the $format
parameter of the
constructor method).
Parameters
- $pos : int
-
seach result resource index
Return values
MetadataInterfacegetResumptionToken()
Saves the current search in a way it can be recreated from the resumption token and returns the resumption token data.
public
getResumptionToken(int $pos) : ResumptionTokenData
Parameters
- $pos : int
-
index of last read resource
Return values
ResumptionTokenDatasetLogger()
Sets a logger for the search object
public
setLogger(AbstractLogger $log) : void
Parameters
- $log : AbstractLogger
setMetadataFormat()
Sets metadata format configuration
public
setMetadataFormat(MetadataFormat|null $format) : void
Parameters
- $format : MetadataFormat|null
-
metadata format descriptor