diff --git a/Classes/Common/Solr/SolrSearch.php b/Classes/Common/Solr/SolrSearch.php index 32f7bad403..a21cc3a8b1 100644 --- a/Classes/Common/Solr/SolrSearch.php +++ b/Classes/Common/Solr/SolrSearch.php @@ -537,7 +537,7 @@ public function submit($start, $rows, $processResults = true) $searchResult['highlight'] = $doc['highlight']; $searchResult['highlight_word'] = preg_replace('/^;|;$/', '', // remove ; at beginning or end preg_replace('/;+/', ';', // replace any multiple of ; with a single ; - preg_replace('/[{~\d*}{\s+}{^=*\d+.*\d*}`~!@#$%\^&*()_|+-=?;:\'",.<>\{\}\[\]\\\]/', ';', $this->searchParams['query']))); // replace search operators and special characters with ; + preg_replace('/[{~\d*}{\s+}{^=*\d+.*\d*}{\sAND\s}{\sOR\s}{\sNOT\s}`~!@#$%\^&*()_|+-=?;:\'",.<>\{\}\[\]\\\]/', ';', $this->searchParams['query']))); // replace search operators and special characters with ; } $documents[$doc['uid']]['searchResults'][] = $searchResult; } diff --git a/Classes/Domain/Repository/DocumentRepository.php b/Classes/Domain/Repository/DocumentRepository.php index 3f04276144..4e4619791b 100644 --- a/Classes/Domain/Repository/DocumentRepository.php +++ b/Classes/Domain/Repository/DocumentRepository.php @@ -683,7 +683,10 @@ public function getPreviousDocumentUid($uid) return $prevDocument['uid']; } - return $this->getLastChild($this->getPreviousDocumentUid($parentId)); + $previousDocumentId = $this->getPreviousDocumentUid($parentId); + if ($previousDocumentId) { + return $this->getLastChild($previousDocumentId); + } } } @@ -727,7 +730,10 @@ public function getNextDocumentUid($uid) return $nextDocument['uid']; } - return $this->getFirstChild($this->getNextDocumentUid($parentId)); + $nextDocumentId = $this->getNextDocumentUid($parentId); + if ($nextDocumentId) { + return $this->getFirstChild($nextDocumentId); + } } } diff --git a/Classes/Middleware/SearchInDocument.php b/Classes/Middleware/SearchInDocument.php index 9c0cfdeed4..9b6baa1ef0 100644 --- a/Classes/Middleware/SearchInDocument.php +++ b/Classes/Middleware/SearchInDocument.php @@ -104,7 +104,9 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface [ 'tx_dlf[id]' => !empty($resultDocument->getUid()) ? $resultDocument->getUid() : $parameters['uid'], 'tx_dlf[page]' => $resultDocument->getPage(), - 'tx_dlf[highlight_word]' => $parameters['q'] + 'tx_dlf[highlight_word]' => preg_replace('/^;|;$/', '', // remove ; at beginning or end + preg_replace('/;+/', ';', // replace any multiple of ; with a single ; + preg_replace('/[{~\d*}{\s+}{^=*\d+.*\d*}{\sAND\s}{\sOR\s}{\sNOT\s}`~!@#$%\^&*()_|+-=?;:\'",.<>\{\}\[\]\\\]/', ';', $parameters['q']))) // replace search operators and special characters with ; ] ); diff --git a/Resources/Public/JavaScript/PageView/SearchInDocument.js b/Resources/Public/JavaScript/PageView/SearchInDocument.js index 6890ca3b80..8ed8b3bb8b 100644 --- a/Resources/Public/JavaScript/PageView/SearchInDocument.js +++ b/Resources/Public/JavaScript/PageView/SearchInDocument.js @@ -212,7 +212,7 @@ function triggerSearchAfterHitLoad() { if(searchedQueryParam && decodeURIComponent(queryParam[0]).indexOf(searchedQueryParam) !== -1) { $("input[id='tx-dlf-search-in-document-query']").val(decodeURIComponent(queryParam[1])); - $("#tx-dlf-search-in-document-form").submit(); + //$("#tx-dlf-search-in-document-form").submit(); break; } }