Skip to content

Commit

Permalink
Merge branch 'master' into fix-searchindocument
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastian-meyer authored Jun 4, 2024
2 parents 06eab68 + b95e9c7 commit be97267
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Classes/Controller/ListViewController.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function mainAction(): void

// extract collection(s) from collection parameter
$collections = [];
if ($this->searchParams['collection']) {
if (array_key_exists('collection', $this->searchParams)) {
foreach(explode(',', $this->searchParams['collection']) as $collectionEntry) {
$collections[] = $this->collectionRepository->findByUid((int) $collectionEntry);
}
Expand Down
26 changes: 15 additions & 11 deletions Classes/Controller/SearchController.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,16 +128,20 @@ public function mainAction(): void
}

// sanitize date search input
if (empty($this->searchParams['dateFrom']) && !empty($this->searchParams['dateTo'])) {
$this->searchParams['dateFrom'] = '*';
}
if (empty($this->searchParams['dateTo']) && !empty($this->searchParams['dateFrom'])) {
$this->searchParams['dateTo'] = 'NOW';
}
if ($this->searchParams['dateFrom'] > $this->searchParams['dateTo']) {
$tmpDate = $this->searchParams['dateFrom'];
$this->searchParams['dateFrom'] = $this->searchParams['dateTo'];
$this->searchParams['dateTo'] = $tmpDate;
if (!empty($this->searchParams['dateFrom']) || !empty($this->searchParams['dateTo'])) {
if (empty($this->searchParams['dateFrom']) && !empty($this->searchParams['dateTo'])) {
$this->searchParams['dateFrom'] = '*';
}

if (empty($this->searchParams['dateTo']) && !empty($this->searchParams['dateFrom'])) {
$this->searchParams['dateTo'] = 'NOW';
}

if ($this->searchParams['dateFrom'] > $this->searchParams['dateTo']) {
$tmpDate = $this->searchParams['dateFrom'];
$this->searchParams['dateFrom'] = $this->searchParams['dateTo'];
$this->searchParams['dateTo'] = $tmpDate;
}
}

// Pagination of Results: Pass the currentPage to the fluid template to calculate current index of search result.
Expand Down Expand Up @@ -386,7 +390,7 @@ private function addCollectionsQuery(string $query): string
// if collections are given, we prepare the collections query string
// extract collections from collection parameter
$collections = null;
if ($this->searchParams['collection']) {
if (array_key_exists('collection', $this->searchParams)) {
foreach (explode(',', $this->searchParams['collection']) as $collectionEntry) {
$collections[] = $this->collectionRepository->findByUid((int) $collectionEntry);
}
Expand Down
10 changes: 4 additions & 6 deletions ext_localconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,19 +82,17 @@
$GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['tx_dlf_pageview_proxy'] = \Kitodo\Dlf\Eid\PageViewProxy::class . '::main';
}
// Use Caching Framework for Solr queries
if (!isset($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['tx_dlf_solr']) || !is_array($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['tx_dlf_solr'])) {
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['tx_dlf_solr'] = [];
}
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['tx_dlf_solr'] ??= [];

if (!isset($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['tx_dlf_solr']['backend'])) {
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['tx_dlf_solr']['backend'] = 'TYPO3\\CMS\\Core\\Cache\\Backend\\FileBackend';
}
if (!isset($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['tx_dlf_solr']['options']['defaultLifeTime'])) {
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['tx_dlf_solr']['options']['defaultLifeTime'] = 86400; // 86400 seconds = 1 day
}
// Use Caching Framework for XML file caching
if (!isset($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['tx_dlf_doc']) || !is_array($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['tx_dlf_doc'])) {
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['tx_dlf_doc'] = [];
}
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['tx_dlf_doc'] ??= [];

if (!isset($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['tx_dlf_doc']['backend'])) {
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['tx_dlf_doc']['backend'] = 'TYPO3\\CMS\\Core\\Cache\\Backend\\FileBackend';
}
Expand Down

0 comments on commit be97267

Please sign in to comment.