Documentation

BaseSearch
in package
implements SearchInterface

Implements basic OAI-PMH search. It is assumed that all OAI-PMH search facets (id, date, set) and data required to create <header> nodes (again id, date, set) are accessible as repository resource's metadata RDF properties.

Mappings between OAI-PMH terms (id, date, set) and RDF properties is provided by the statically initialized acdhOeaw\util\RepoConfig class.

Includes metadataClass::extendSearchQuery() SPARQL query part in the performed search (where metadataClass is read from the metadata format descriptor).

Tags
author

zozlak

Table of Contents

Interfaces

SearchInterface
Interface for classes implementing OAI-PMH resources search.

Properties

$config  : object
Configuration object
$deleted  : DeletedInterface
Object handling deleted resources information
$format  : MetadataFormat|null
Metadata format descriptor.
$pdo  : PDO
Repistory database connection object
$records  : array<string|int, HeaderData>
Last search results
$repo  : RepoDb
High-level repository API handle object
$resumptionCount  : int
Total number of resources of the original search read from the resumption dump file
$resumptionCursor  : int
Value of the resumptionCursor attribute read from the resumption dump file
$resumptionToken  : string|null
Resumption token value used
$sets  : SetInterface
Object handling sets
$t0  : int
Object creation timestamp. Used to determine resumption timeout.

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
getDateFilter()  : QueryPart
Creates SPARQL clauses implementing the date filter.
getIdFilter()  : QueryPart
Creates SPARQL query clause implementing the id filter.
getSetFilter()  : QueryPart
Creates SPARQL clause implementing the set filter.

Properties

$config

Configuration object

private object $config

$pdo

Repistory database connection object

private PDO $pdo

$resumptionCount

Total number of resources of the original search read from the resumption dump file

private int $resumptionCount

$resumptionCursor

Value of the resumptionCursor attribute read from the resumption dump file

private int $resumptionCursor = 0

$resumptionToken

Resumption token value used

private string|null $resumptionToken

$t0

Object creation timestamp. Used to determine resumption timeout.

private int $t0

Methods

checkResumptionTimeout()

Checks if the timeout for resumption token generation has been reached.

public checkResumptionTimeout() : bool

If it is reached, returns true.

Return values
bool

find()

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
string

getCount()

Returns number of resources matching last search (last call of the `find()` method).

public getCount() : int
Return values
int

getHeader()

Provides the `HeaderData` object for a given search result.

public getHeader(int $pos) : HeaderData
Parameters
$pos : int

seach result resource index

Return values
HeaderData

getResumptionToken()

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
ResumptionTokenData

setLogger()

Sets a logger for the search object

public setLogger(AbstractLogger $log) : void
Parameters
$log : AbstractLogger

getDateFilter()

Creates SPARQL clauses implementing the date filter.

private getDateFilter(string $from, string $until) : QueryPart
Parameters
$from : string

date from filter value

$until : string

date to filter value

Return values
QueryPart

getIdFilter()

Creates SPARQL query clause implementing the id filter.

private getIdFilter(string $id) : QueryPart
Parameters
$id : string

id filter value

Return values
QueryPart

getSetFilter()

Creates SPARQL clause implementing the set filter.

private getSetFilter(string $set) : QueryPart
Parameters
$set : string

set filter value

Return values
QueryPart

        
On this page

Search results