Skip to content
Snippets Groups Projects
Commit 691be78c authored by Demian Katz's avatar Demian Katz
Browse files

When a set_query is selected, show it in headers.

- Improves OAI-PMH validation.
parent e53def7f
No related merge requests found
......@@ -297,11 +297,12 @@ class Server
* @param object $record A record driver object
* @param string $format Metadata format to obtain (false for none)
* @param bool $headerOnly Only attach the header?
* @param string $set Currently active set
*
* @return bool
*/
protected function attachNonDeleted($container, $record, $format,
$headerOnly = false
$headerOnly = false, $set = ''
) {
// Get the XML (and display an error if it is unsupported):
if ($format === false) {
......@@ -324,10 +325,13 @@ class Server
// Check for sets:
$fields = $record->getRawData();
if (null !== $this->setField && !empty($fields[$this->setField])) {
$sets = $fields[$this->setField];
$sets = (array)$fields[$this->setField];
} else {
$sets = [];
}
if (!empty($set)) {
$sets = array_unique(array_merge($sets, [$set]));
}
// Get modification date:
$date = $record->getLastIndexed();
......@@ -598,14 +602,14 @@ class Server
$solrLimit = ($params['cursor'] + $this->pageSize) - $currentCursor;
// Get non-deleted records from the Solr index:
$set = $params['set'] ?? '';
$result = $this->listRecordsGetNonDeleted(
$from, $until, $solrOffset, $solrLimit,
$params['set'] ?? ''
$from, $until, $solrOffset, $solrLimit, $set
);
$nonDeletedCount = $result->getResultTotal();
$format = $params['metadataPrefix'];
foreach ($result->getResults() as $doc) {
if (!$this->attachNonDeleted($xml, $doc, $format, $headersOnly)) {
if (!$this->attachNonDeleted($xml, $doc, $format, $headersOnly, $set)) {
$this->unexpectedError('Cannot load document');
}
$currentCursor++;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment