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

Merge branch 'release-5.0'

parents 624980fd 691be78c
Branches
Tags
No related merge requests found
...@@ -297,11 +297,12 @@ class Server ...@@ -297,11 +297,12 @@ class Server
* @param object $record A record driver object * @param object $record A record driver object
* @param string $format Metadata format to obtain (false for none) * @param string $format Metadata format to obtain (false for none)
* @param bool $headerOnly Only attach the header? * @param bool $headerOnly Only attach the header?
* @param string $set Currently active set
* *
* @return bool * @return bool
*/ */
protected function attachNonDeleted($container, $record, $format, protected function attachNonDeleted($container, $record, $format,
$headerOnly = false $headerOnly = false, $set = ''
) { ) {
// Get the XML (and display an error if it is unsupported): // Get the XML (and display an error if it is unsupported):
if ($format === false) { if ($format === false) {
...@@ -324,10 +325,13 @@ class Server ...@@ -324,10 +325,13 @@ class Server
// Check for sets: // Check for sets:
$fields = $record->getRawData(); $fields = $record->getRawData();
if (null !== $this->setField && !empty($fields[$this->setField])) { if (null !== $this->setField && !empty($fields[$this->setField])) {
$sets = $fields[$this->setField]; $sets = (array)$fields[$this->setField];
} else { } else {
$sets = []; $sets = [];
} }
if (!empty($set)) {
$sets = array_unique(array_merge($sets, [$set]));
}
// Get modification date: // Get modification date:
$date = $record->getLastIndexed(); $date = $record->getLastIndexed();
...@@ -598,14 +602,14 @@ class Server ...@@ -598,14 +602,14 @@ class Server
$solrLimit = ($params['cursor'] + $this->pageSize) - $currentCursor; $solrLimit = ($params['cursor'] + $this->pageSize) - $currentCursor;
// Get non-deleted records from the Solr index: // Get non-deleted records from the Solr index:
$set = $params['set'] ?? '';
$result = $this->listRecordsGetNonDeleted( $result = $this->listRecordsGetNonDeleted(
$from, $until, $solrOffset, $solrLimit, $from, $until, $solrOffset, $solrLimit, $set
$params['set'] ?? ''
); );
$nonDeletedCount = $result->getResultTotal(); $nonDeletedCount = $result->getResultTotal();
$format = $params['metadataPrefix']; $format = $params['metadataPrefix'];
foreach ($result->getResults() as $doc) { 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'); $this->unexpectedError('Cannot load document');
} }
$currentCursor++; $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