@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | if ($result->rowCount() == 1) { |
| 63 | 63 | $pageRenderer = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Page\PageRenderer::class); |
| 64 | - $pageRenderer->addJsFooterFile(\TYPO3\CMS\Core\Utility\PathUtility::stripPathSitePrefix(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($this->extKey)) . 'Resources/Public/Javascript/Search/Suggester.js'); |
|
| 64 | + $pageRenderer->addJsFooterFile(\TYPO3\CMS\Core\Utility\PathUtility::stripPathSitePrefix(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($this->extKey)).'Resources/Public/Javascript/Search/Suggester.js'); |
|
| 65 | 65 | } else { |
| 66 | 66 | $this->logger->warning('No metadata fields configured for search suggestions'); |
| 67 | 67 | } |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | && $list->metadata['options']['source'] == 'collection' |
| 84 | 84 | ) { |
| 85 | 85 | // Get collection's UID. |
| 86 | - return '<input type="hidden" name="' . $this->prefixId . '[collection]" value="' . $list->metadata['options']['select'] . '" />'; |
|
| 86 | + return '<input type="hidden" name="'.$this->prefixId.'[collection]" value="'.$list->metadata['options']['select'].'" />'; |
|
| 87 | 87 | } elseif (!empty($list->metadata['options']['params']['filterquery'])) { |
| 88 | 88 | // Get collection's UID from search metadata. |
| 89 | 89 | foreach ($list->metadata['options']['params']['filterquery'] as $facet) { |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | $collectionId = Helper::getUidFromIndexName(trim($facetKeyVal[1], '(")'), 'tx_dlf_collections'); |
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | - return '<input type="hidden" name="' . $this->prefixId . '[collection]" value="' . $collectionId . '" />'; |
|
| 98 | + return '<input type="hidden" name="'.$this->prefixId.'[collection]" value="'.$collectionId.'" />'; |
|
| 99 | 99 | } |
| 100 | 100 | return ''; |
| 101 | 101 | } |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | $this->loadDocument(); |
| 120 | 120 | // Get document's UID |
| 121 | 121 | if ($this->doc->ready) { |
| 122 | - return '<input type="hidden" name="' . $this->prefixId . '[id]" value="' . ($this->doc->uid) . '" />'; |
|
| 122 | + return '<input type="hidden" name="'.$this->prefixId.'[id]" value="'.($this->doc->uid).'" />'; |
|
| 123 | 123 | } |
| 124 | 124 | } elseif (!empty($list->metadata['options']['params']['filterquery'])) { |
| 125 | 125 | // Get document's UID from search metadata. |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | } |
| 135 | 135 | } |
| 136 | 136 | if (!empty($documentId)) { |
| 137 | - return '<input type="hidden" name="' . $this->prefixId . '[id]" value="' . $documentId . '" />'; |
|
| 137 | + return '<input type="hidden" name="'.$this->prefixId.'[id]" value="'.$documentId.'" />'; |
|
| 138 | 138 | } |
| 139 | 139 | } |
| 140 | 140 | return ''; |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | } |
| 158 | 158 | // Add encrypted fields to search form. |
| 159 | 159 | if ($name !== false) { |
| 160 | - return '<input type="hidden" name="' . $this->prefixId . '[encrypted]" value="' . $name . '" />'; |
|
| 160 | + return '<input type="hidden" name="'.$this->prefixId.'[encrypted]" value="'.$name.'" />'; |
|
| 161 | 161 | } else { |
| 162 | 162 | return ''; |
| 163 | 163 | } |
@@ -183,19 +183,19 @@ discard block |
||
| 183 | 183 | // Get operator options. |
| 184 | 184 | $operatorOptions = ''; |
| 185 | 185 | foreach (['AND', 'OR', 'NOT'] as $operator) { |
| 186 | - $operatorOptions .= '<option class="tx-dlf-search-operator-option tx-dlf-search-operator-' . $operator . '" value="' . $operator . '">' . htmlspecialchars($this->pi_getLL($operator, '')) . '</option>'; |
|
| 186 | + $operatorOptions .= '<option class="tx-dlf-search-operator-option tx-dlf-search-operator-'.$operator.'" value="'.$operator.'">'.htmlspecialchars($this->pi_getLL($operator, '')).'</option>'; |
|
| 187 | 187 | } |
| 188 | 188 | // Get field selector options. |
| 189 | 189 | $fieldSelectorOptions = ''; |
| 190 | 190 | $searchFields = GeneralUtility::trimExplode(',', $this->conf['extendedFields'], true); |
| 191 | 191 | foreach ($searchFields as $searchField) { |
| 192 | - $fieldSelectorOptions .= '<option class="tx-dlf-search-field-option tx-dlf-search-field-' . $searchField . '" value="' . $searchField . '">' . Helper::translate($searchField, 'tx_dlf_metadata', $this->conf['pages']) . '</option>'; |
|
| 192 | + $fieldSelectorOptions .= '<option class="tx-dlf-search-field-option tx-dlf-search-field-'.$searchField.'" value="'.$searchField.'">'.Helper::translate($searchField, 'tx_dlf_metadata', $this->conf['pages']).'</option>'; |
|
| 193 | 193 | } |
| 194 | 194 | for ($i = 0; $i < $this->conf['extendedSlotCount']; $i++) { |
| 195 | 195 | $markerArray = [ |
| 196 | - '###EXT_SEARCH_OPERATOR###' => '<select class="tx-dlf-search-operator tx-dlf-search-operator-' . $i . '" name="' . $this->prefixId . '[extOperator][' . $i . ']">' . $operatorOptions . '</select>', |
|
| 197 | - '###EXT_SEARCH_FIELDSELECTOR###' => '<select class="tx-dlf-search-field tx-dlf-search-field-' . $i . '" name="' . $this->prefixId . '[extField][' . $i . ']">' . $fieldSelectorOptions . '</select>', |
|
| 198 | - '###EXT_SEARCH_FIELDQUERY###' => '<input class="tx-dlf-search-query tx-dlf-search-query-' . $i . '" type="text" name="' . $this->prefixId . '[extQuery][' . $i . ']" />' |
|
| 196 | + '###EXT_SEARCH_OPERATOR###' => '<select class="tx-dlf-search-operator tx-dlf-search-operator-'.$i.'" name="'.$this->prefixId.'[extOperator]['.$i.']">'.$operatorOptions.'</select>', |
|
| 197 | + '###EXT_SEARCH_FIELDSELECTOR###' => '<select class="tx-dlf-search-field tx-dlf-search-field-'.$i.'" name="'.$this->prefixId.'[extField]['.$i.']">'.$fieldSelectorOptions.'</select>', |
|
| 198 | + '###EXT_SEARCH_FIELDQUERY###' => '<input class="tx-dlf-search-query tx-dlf-search-query-'.$i.'" type="text" name="'.$this->prefixId.'[extQuery]['.$i.']" />' |
|
| 199 | 199 | ]; |
| 200 | 200 | $extendedSearch .= $this->templateService->substituteMarkerArray($this->templateService->getSubpart($this->template, '###EXT_SEARCH_ENTRY###'), $markerArray); |
| 201 | 201 | } |
@@ -223,12 +223,12 @@ discard block |
||
| 223 | 223 | // Get facets from plugin configuration. |
| 224 | 224 | $facets = []; |
| 225 | 225 | foreach (GeneralUtility::trimExplode(',', $this->conf['facets'], true) as $facet) { |
| 226 | - $facets[$facet . '_faceting'] = Helper::translate($facet, 'tx_dlf_metadata', $this->conf['pages']); |
|
| 226 | + $facets[$facet.'_faceting'] = Helper::translate($facet, 'tx_dlf_metadata', $this->conf['pages']); |
|
| 227 | 227 | } |
| 228 | 228 | // Render facets menu. |
| 229 | 229 | $TSconfig = []; |
| 230 | 230 | $TSconfig['special'] = 'userfunction'; |
| 231 | - $TSconfig['special.']['userFunc'] = \Kitodo\Dlf\Plugin\Search::class . '->makeFacetsMenuArray'; |
|
| 231 | + $TSconfig['special.']['userFunc'] = \Kitodo\Dlf\Plugin\Search::class.'->makeFacetsMenuArray'; |
|
| 232 | 232 | $TSconfig['special.']['facets'] = $facets; |
| 233 | 233 | $TSconfig['special.']['limit'] = max(intval($this->conf['limitFacets']), 1); |
| 234 | 234 | $TSconfig = Helper::mergeRecursiveWithOverrule($this->conf['facetsConf.'], $TSconfig); |
@@ -249,10 +249,10 @@ discard block |
||
| 249 | 249 | $output = ''; |
| 250 | 250 | // Check for plugin configuration. |
| 251 | 251 | if (!empty($this->conf['fulltext'])) { |
| 252 | - $output .= ' <input class="tx-dlf-search-fulltext" id="tx-dlf-search-fulltext-no" type="radio" name="' . $this->prefixId . '[fulltext]" value="0" ' . ($isFulltextSearch == 0 ? 'checked="checked"' : '') . ' />'; |
|
| 253 | - $output .= ' <label for="tx-dlf-search-fulltext-no">' . htmlspecialchars($this->pi_getLL('label.inMetadata', '')) . '</label>'; |
|
| 254 | - $output .= ' <input class="tx-dlf-search-fulltext" id="tx-dlf-search-fulltext-yes" type="radio" name="' . $this->prefixId . '[fulltext]" value="1" ' . ($isFulltextSearch == 1 ? 'checked="checked"' : '') . '/>'; |
|
| 255 | - $output .= ' <label for="tx-dlf-search-fulltext-yes">' . htmlspecialchars($this->pi_getLL('label.inFulltext', '')) . '</label>'; |
|
| 252 | + $output .= ' <input class="tx-dlf-search-fulltext" id="tx-dlf-search-fulltext-no" type="radio" name="'.$this->prefixId.'[fulltext]" value="0" '.($isFulltextSearch == 0 ? 'checked="checked"' : '').' />'; |
|
| 253 | + $output .= ' <label for="tx-dlf-search-fulltext-no">'.htmlspecialchars($this->pi_getLL('label.inMetadata', '')).'</label>'; |
|
| 254 | + $output .= ' <input class="tx-dlf-search-fulltext" id="tx-dlf-search-fulltext-yes" type="radio" name="'.$this->prefixId.'[fulltext]" value="1" '.($isFulltextSearch == 1 ? 'checked="checked"' : '').'/>'; |
|
| 255 | + $output .= ' <label for="tx-dlf-search-fulltext-yes">'.htmlspecialchars($this->pi_getLL('label.inFulltext', '')).'</label>'; |
|
| 256 | 256 | } |
| 257 | 257 | return $output; |
| 258 | 258 | } |
@@ -269,8 +269,8 @@ discard block |
||
| 269 | 269 | $output = ''; |
| 270 | 270 | // Check for plugin configuration. |
| 271 | 271 | if (!empty($this->conf['showLogicalPageField'])) { |
| 272 | - $output .= ' <label for="tx-dlf-search-logical-page">' . htmlspecialchars($this->pi_getLL('label.logicalPage', '')) . ': </label>'; |
|
| 273 | - $output .= ' <input class="tx-dlf-search-logical-page" id="tx-dlf-search-logical-page" type="text" name="' . $this->prefixId . '[logicalPage]" />'; |
|
| 272 | + $output .= ' <label for="tx-dlf-search-logical-page">'.htmlspecialchars($this->pi_getLL('label.logicalPage', '')).': </label>'; |
|
| 273 | + $output .= ' <input class="tx-dlf-search-logical-page" id="tx-dlf-search-logical-page" type="text" name="'.$this->prefixId.'[logicalPage]" />'; |
|
| 274 | 274 | } |
| 275 | 275 | return $output; |
| 276 | 276 | } |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | $entryArray['doNotLinkIt'] = 0; |
| 312 | 312 | // Check if facet is already selected. |
| 313 | 313 | $queryColumn = array_column($search['params']['filterquery'], 'query'); |
| 314 | - $index = array_search($field . ':("' . Solr::escapeQuery($value) . '")', $queryColumn); |
|
| 314 | + $index = array_search($field.':("'.Solr::escapeQuery($value).'")', $queryColumn); |
|
| 315 | 315 | if ($index !== false) { |
| 316 | 316 | // Facet is selected, thus remove it from filter. |
| 317 | 317 | unset($queryColumn[$index]); |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | } |
| 329 | 329 | } else { |
| 330 | 330 | // Facet is not selected, thus add it to filter. |
| 331 | - $queryColumn[] = $field . ':("' . Solr::escapeQuery($value) . '")'; |
|
| 331 | + $queryColumn[] = $field.':("'.Solr::escapeQuery($value).'")'; |
|
| 332 | 332 | $entryArray['ITEM_STATE'] = 'NO'; |
| 333 | 333 | } |
| 334 | 334 | $entryArray['_OVERRIDE_HREF'] = $this->pi_linkTP_keepPIvars_url(['query' => $search['query'], 'fq' => $queryColumn]); |
@@ -384,7 +384,7 @@ discard block |
||
| 384 | 384 | '###ACTION_URL###' => $this->cObj->typoLink_URL($linkConf), |
| 385 | 385 | '###LABEL_QUERY###' => (!empty($search['query']) ? htmlspecialchars($search['query']) : htmlspecialchars($this->pi_getLL('label.query'))), |
| 386 | 386 | '###LABEL_SUBMIT###' => htmlspecialchars($this->pi_getLL('label.submit')), |
| 387 | - '###FIELD_QUERY###' => $this->prefixId . '[query]', |
|
| 387 | + '###FIELD_QUERY###' => $this->prefixId.'[query]', |
|
| 388 | 388 | '###QUERY###' => (!empty($search['query']) ? htmlspecialchars($search['query']) : ''), |
| 389 | 389 | '###FULLTEXTSWITCH###' => $this->addFulltextSwitch($list->metadata['fulltextSearch']), |
| 390 | 390 | '###FIELD_DOC###' => ($this->conf['searchIn'] == 'document' || $this->conf['searchIn'] == 'all' ? $this->addCurrentDocument() : ''), |
@@ -411,13 +411,13 @@ discard block |
||
| 411 | 411 | // Set search query. |
| 412 | 412 | if ( |
| 413 | 413 | (!empty($this->conf['fulltext']) && !empty($this->piVars['fulltext'])) |
| 414 | - || preg_match('/' . $fields['fulltext'] . ':\((.*)\)/', trim($this->piVars['query']), $matches) |
|
| 414 | + || preg_match('/'.$fields['fulltext'].':\((.*)\)/', trim($this->piVars['query']), $matches) |
|
| 415 | 415 | ) { |
| 416 | 416 | // If the query already is a fulltext query e.g using the facets |
| 417 | 417 | $this->piVars['query'] = empty($matches[1]) ? $this->piVars['query'] : $matches[1]; |
| 418 | 418 | // Search in fulltext field if applicable. Query must not be empty! |
| 419 | 419 | if (!empty($this->piVars['query'])) { |
| 420 | - $query = $fields['fulltext'] . ':(' . Solr::escapeQuery(trim($this->piVars['query'])) . ')'; |
|
| 420 | + $query = $fields['fulltext'].':('.Solr::escapeQuery(trim($this->piVars['query'])).')'; |
|
| 421 | 421 | } |
| 422 | 422 | } else { |
| 423 | 423 | // Retain given search field if valid. |
@@ -438,9 +438,9 @@ discard block |
||
| 438 | 438 | && in_array($this->piVars['extField'][$i], $allowedFields) |
| 439 | 439 | ) { |
| 440 | 440 | if (!empty($query)) { |
| 441 | - $query .= ' ' . $this->piVars['extOperator'][$i] . ' '; |
|
| 441 | + $query .= ' '.$this->piVars['extOperator'][$i].' '; |
|
| 442 | 442 | } |
| 443 | - $query .= Indexer::getIndexFieldName($this->piVars['extField'][$i], $this->conf['pages']) . ':(' . Solr::escapeQuery($this->piVars['extQuery'][$i]) . ')'; |
|
| 443 | + $query .= Indexer::getIndexFieldName($this->piVars['extField'][$i], $this->conf['pages']).':('.Solr::escapeQuery($this->piVars['extQuery'][$i]).')'; |
|
| 444 | 444 | } |
| 445 | 445 | } |
| 446 | 446 | } |
@@ -462,12 +462,12 @@ discard block |
||
| 462 | 462 | ) { |
| 463 | 463 | // Search in document and all subordinates (valid for up to three levels of hierarchy). |
| 464 | 464 | $params['filterquery'][]['query'] = '_query_:"{!join from=' |
| 465 | - . $fields['uid'] . ' to=' . $fields['partof'] . '}' |
|
| 466 | - . $fields['uid'] . ':{!join from=' . $fields['uid'] . ' to=' . $fields['partof'] . '}' |
|
| 467 | - . $fields['uid'] . ':' . $this->piVars['id'] . '"' . ' OR {!join from=' |
|
| 468 | - . $fields['uid'] . ' to=' . $fields['partof'] . '}' |
|
| 469 | - . $fields['uid'] . ':' . $this->piVars['id'] . ' OR ' |
|
| 470 | - . $fields['uid'] . ':' . $this->piVars['id']; |
|
| 465 | + . $fields['uid'].' to='.$fields['partof'].'}' |
|
| 466 | + . $fields['uid'].':{!join from='.$fields['uid'].' to='.$fields['partof'].'}' |
|
| 467 | + . $fields['uid'].':'.$this->piVars['id'].'"'.' OR {!join from=' |
|
| 468 | + . $fields['uid'].' to='.$fields['partof'].'}' |
|
| 469 | + . $fields['uid'].':'.$this->piVars['id'].' OR ' |
|
| 470 | + . $fields['uid'].':'.$this->piVars['id']; |
|
| 471 | 471 | $label .= htmlspecialchars(sprintf($this->pi_getLL('in', ''), Document::getTitle($this->piVars['id']))); |
| 472 | 472 | } |
| 473 | 473 | } |
@@ -481,7 +481,7 @@ discard block |
||
| 481 | 481 | && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->piVars['collection']) |
| 482 | 482 | ) { |
| 483 | 483 | $index_name = Helper::getIndexNameFromUid($this->piVars['collection'], 'tx_dlf_collections', $this->conf['pages']); |
| 484 | - $params['filterquery'][]['query'] = 'collection_faceting:("' . Solr::escapeQuery($index_name) . '")'; |
|
| 484 | + $params['filterquery'][]['query'] = 'collection_faceting:("'.Solr::escapeQuery($index_name).'")'; |
|
| 485 | 485 | $label .= sprintf($this->pi_getLL('in', '', true), Helper::translate($index_name, 'tx_dlf_collections', $this->conf['pages'])); |
| 486 | 486 | } |
| 487 | 487 | } |
@@ -493,7 +493,7 @@ discard block |
||
| 493 | 493 | $collIndexNames[] = Solr::escapeQuery(Helper::getIndexNameFromUid(intval($collId), 'tx_dlf_collections', $this->conf['pages'])); |
| 494 | 494 | } |
| 495 | 495 | // Last value is fake and used for distinction in $this->addCurrentCollection() |
| 496 | - $params['filterquery'][]['query'] = 'collection_faceting:("' . implode('" OR "', $collIndexNames) . '" OR "FakeValueForDistinction")'; |
|
| 496 | + $params['filterquery'][]['query'] = 'collection_faceting:("'.implode('" OR "', $collIndexNames).'" OR "FakeValueForDistinction")'; |
|
| 497 | 497 | } |
| 498 | 498 | // Set some query parameters. |
| 499 | 499 | $params['query'] = !empty($query) ? $query : '*'; |
@@ -543,7 +543,7 @@ discard block |
||
| 543 | 543 | $linkConf['forceAbsoluteUrl.']['scheme'] = !empty($this->conf['forceAbsoluteUrl']) && !empty($this->conf['forceAbsoluteUrlHttps']) ? 'https' : 'http'; |
| 544 | 544 | $linkConf['additionalParams'] = GeneralUtility::implodeArrayForUrl($this->prefixId, $additionalParams, '', true, false); |
| 545 | 545 | // Send headers. |
| 546 | - header('Location: ' . GeneralUtility::locationHeaderUrl($this->cObj->typoLink_URL($linkConf))); |
|
| 546 | + header('Location: '.GeneralUtility::locationHeaderUrl($this->cObj->typoLink_URL($linkConf))); |
|
| 547 | 547 | exit; |
| 548 | 548 | } |
| 549 | 549 | } |
@@ -58,7 +58,7 @@ |
||
| 58 | 58 | if ($solr->ready) { |
| 59 | 59 | $query = $solr->service->createSelect(); |
| 60 | 60 | $query->setFields([$fields['id'], $fields['uid'], $fields['page']]); |
| 61 | - $query->setQuery($fields['fulltext'] . ':(' . Solr::escapeQuery((string) $parameters['q']) . ') AND ' . $fields['uid'] . ':' . intval($parameters['uid'])); |
|
| 61 | + $query->setQuery($fields['fulltext'].':('.Solr::escapeQuery((string) $parameters['q']).') AND '.$fields['uid'].':'.intval($parameters['uid'])); |
|
| 62 | 62 | $query->setStart($count)->setRows(20); |
| 63 | 63 | $hl = $query->getHighlighting(); |
| 64 | 64 | $hl->setFields([$fields['fulltext']]); |
@@ -62,7 +62,7 @@ |
||
| 62 | 62 | $query->setStart($count)->setRows(20); |
| 63 | 63 | $hl = $query->getHighlighting(); |
| 64 | 64 | $hl->setFields([$fields['fulltext']]); |
| 65 | - $hl->setUseFastVectorHighlighter(true); |
|
| 65 | + $hl->setUseFastVectorHighlighter(TRUE); |
|
| 66 | 66 | $results = $solr->service->select($query); |
| 67 | 67 | $output['numFound'] = $results->getNumFound(); |
| 68 | 68 | $highlighting = $results->getHighlighting(); |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | if ($this->valid()) { |
| 138 | 138 | return $this->getRecord($this->elements[$this->position]); |
| 139 | 139 | } else { |
| 140 | - $this->logger->notice('Invalid position "' . $this->position . '" for list element'); |
|
| 140 | + $this->logger->notice('Invalid position "'.$this->position.'" for list element'); |
|
| 141 | 141 | return; |
| 142 | 142 | } |
| 143 | 143 | } |
@@ -240,9 +240,9 @@ discard block |
||
| 240 | 240 | $fields = Solr::getFields(); |
| 241 | 241 | $params = []; |
| 242 | 242 | // Restrict the fields to the required ones |
| 243 | - $params['fields'] = $fields['uid'] . ',' . $fields['id'] . ',' . $fields['toplevel'] . ',' . $fields['thumbnail'] . ',' . $fields['page']; |
|
| 243 | + $params['fields'] = $fields['uid'].','.$fields['id'].','.$fields['toplevel'].','.$fields['thumbnail'].','.$fields['page']; |
|
| 244 | 244 | foreach ($this->solrConfig as $solr_name) { |
| 245 | - $params['fields'] .= ',' . $solr_name; |
|
| 245 | + $params['fields'] .= ','.$solr_name; |
|
| 246 | 246 | } |
| 247 | 247 | // If it is a fulltext search, enable highlighting. |
| 248 | 248 | if ($this->metadata['fulltextSearch']) { |
@@ -264,15 +264,15 @@ discard block |
||
| 264 | 264 | // Extend filter query to get all documents with the same UID. |
| 265 | 265 | foreach ($params['filterquery'] as $key => $value) { |
| 266 | 266 | if (isset($value['query'])) { |
| 267 | - $params['filterquery'][$key]['query'] = $value['query'] . ' OR ' . $fields['toplevel'] . ':true'; |
|
| 267 | + $params['filterquery'][$key]['query'] = $value['query'].' OR '.$fields['toplevel'].':true'; |
|
| 268 | 268 | } |
| 269 | 269 | } |
| 270 | 270 | // Add filter query to get all documents with the required uid. |
| 271 | - $params['filterquery'][] = ['query' => $fields['uid'] . ':' . Solr::escapeQuery($record['uid'])]; |
|
| 271 | + $params['filterquery'][] = ['query' => $fields['uid'].':'.Solr::escapeQuery($record['uid'])]; |
|
| 272 | 272 | // Add sorting. |
| 273 | 273 | $params['sort'] = $this->metadata['options']['params']['sort']; |
| 274 | 274 | // Set query. |
| 275 | - $params['query'] = $this->metadata['options']['select'] . ' OR ' . $fields['toplevel'] . ':true'; |
|
| 275 | + $params['query'] = $this->metadata['options']['select'].' OR '.$fields['toplevel'].':true'; |
|
| 276 | 276 | // Perform search for all documents with the same uid that either fit to the search or marked as toplevel. |
| 277 | 277 | $selectQuery = $this->solr->service->createSelect($params); |
| 278 | 278 | $result = $this->solr->service->select($selectQuery); |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | $position < 0 |
| 348 | 348 | || $position >= $this->count |
| 349 | 349 | ) { |
| 350 | - $this->logger->warning('Invalid position "' . $position . '" for element moving'); |
|
| 350 | + $this->logger->warning('Invalid position "'.$position.'" for element moving'); |
|
| 351 | 351 | return; |
| 352 | 352 | } |
| 353 | 353 | $steps = intval($steps); |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | if (($position + $steps) < 0 |
| 356 | 356 | || ($position + $steps) >= $this->count |
| 357 | 357 | ) { |
| 358 | - $this->logger->warning('Invalid steps "' . $steps . '" for moving element at position "' . $position . '"'); |
|
| 358 | + $this->logger->warning('Invalid steps "'.$steps.'" for moving element at position "'.$position.'"'); |
|
| 359 | 359 | return; |
| 360 | 360 | } |
| 361 | 361 | $element = $this->remove($position); |
@@ -433,7 +433,7 @@ discard block |
||
| 433 | 433 | if ($this->offsetExists($offset)) { |
| 434 | 434 | return $this->getRecord($this->elements[$offset]); |
| 435 | 435 | } else { |
| 436 | - $this->logger->notice('Invalid offset "' . $offset . '" for list element'); |
|
| 436 | + $this->logger->notice('Invalid offset "'.$offset.'" for list element'); |
|
| 437 | 437 | return; |
| 438 | 438 | } |
| 439 | 439 | } |
@@ -477,7 +477,7 @@ discard block |
||
| 477 | 477 | $position < 0 |
| 478 | 478 | || $position >= $this->count |
| 479 | 479 | ) { |
| 480 | - $this->logger->warning('Invalid position "' . $position . '" for element removing'); |
|
| 480 | + $this->logger->warning('Invalid position "'.$position.'" for element removing'); |
|
| 481 | 481 | return; |
| 482 | 482 | } |
| 483 | 483 | $removed = array_splice($this->elements, $position, 1); |
@@ -502,7 +502,7 @@ discard block |
||
| 502 | 502 | $position < 0 |
| 503 | 503 | || $position >= $this->count |
| 504 | 504 | ) { |
| 505 | - $this->logger->warning('Invalid position "' . $position . '" for element removing'); |
|
| 505 | + $this->logger->warning('Invalid position "'.$position.'" for element removing'); |
|
| 506 | 506 | return; |
| 507 | 507 | } |
| 508 | 508 | $removed = array_splice($this->elements, $position, $length); |
@@ -595,7 +595,7 @@ discard block |
||
| 595 | 595 | ->execute(); |
| 596 | 596 | |
| 597 | 597 | while ($resArray = $result->fetch()) { |
| 598 | - $this->solrConfig[$resArray['index_name']] = $resArray['index_name'] . '_' . ($resArray['index_tokenized'] ? 't' : 'u') . 's' . ($resArray['index_indexed'] ? 'i' : 'u'); |
|
| 598 | + $this->solrConfig[$resArray['index_name']] = $resArray['index_name'].'_'.($resArray['index_tokenized'] ? 't' : 'u').'s'.($resArray['index_indexed'] ? 'i' : 'u'); |
|
| 599 | 599 | } |
| 600 | 600 | // Add static fields. |
| 601 | 601 | $this->solrConfig['type'] = 'type'; |
@@ -623,7 +623,7 @@ discard block |
||
| 623 | 623 | foreach ($this->elements as $num => $element) { |
| 624 | 624 | // Is this element sortable? |
| 625 | 625 | if (!empty($element['s'][$by])) { |
| 626 | - $newOrder[$element['s'][$by] . str_pad($num, 6, '0', STR_PAD_LEFT)] = $element; |
|
| 626 | + $newOrder[$element['s'][$by].str_pad($num, 6, '0', STR_PAD_LEFT)] = $element; |
|
| 627 | 627 | } else { |
| 628 | 628 | $nonSortable[] = $element; |
| 629 | 629 | } |
@@ -761,12 +761,12 @@ discard block |
||
| 761 | 761 | */ |
| 762 | 762 | public function __get($var) |
| 763 | 763 | { |
| 764 | - $method = '_get' . ucfirst($var); |
|
| 764 | + $method = '_get'.ucfirst($var); |
|
| 765 | 765 | if ( |
| 766 | 766 | !property_exists($this, $var) |
| 767 | 767 | || !method_exists($this, $method) |
| 768 | 768 | ) { |
| 769 | - $this->logger->warning('There is no getter function for property "' . $var . '"'); |
|
| 769 | + $this->logger->warning('There is no getter function for property "'.$var.'"'); |
|
| 770 | 770 | return; |
| 771 | 771 | } else { |
| 772 | 772 | return $this->$method(); |
@@ -799,12 +799,12 @@ discard block |
||
| 799 | 799 | */ |
| 800 | 800 | public function __set($var, $value) |
| 801 | 801 | { |
| 802 | - $method = '_set' . ucfirst($var); |
|
| 802 | + $method = '_set'.ucfirst($var); |
|
| 803 | 803 | if ( |
| 804 | 804 | !property_exists($this, $var) |
| 805 | 805 | || !method_exists($this, $method) |
| 806 | 806 | ) { |
| 807 | - $this->logger->warning('There is no setter function for property "' . $var . '"'); |
|
| 807 | + $this->logger->warning('There is no setter function for property "'.$var.'"'); |
|
| 808 | 808 | } else { |
| 809 | 809 | $this->$method($value); |
| 810 | 810 | } |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | if ($resArray['uid'] == $record['uid']) { |
| 223 | 223 | $record['thumbnail'] = $resArray['thumbnail']; |
| 224 | 224 | $record['metadata'] = $metadata; |
| 225 | - } elseif (($key = array_search(['u' => $resArray['uid']], $record['subparts'], true)) !== false) { |
|
| 225 | + } elseif (($key = array_search(['u' => $resArray['uid']], $record['subparts'], TRUE)) !== FALSE) { |
|
| 226 | 226 | $record['subparts'][$key] = [ |
| 227 | 227 | 'uid' => $resArray['uid'], |
| 228 | 228 | 'page' => 1, |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | 'highlighting' => [ |
| 251 | 251 | 'query' => Solr::escapeQuery($this->metadata['searchString']), |
| 252 | 252 | 'field' => $fields['fulltext'], |
| 253 | - 'usefastvectorhighlighter' => true |
|
| 253 | + 'usefastvectorhighlighter' => TRUE |
|
| 254 | 254 | ] |
| 255 | 255 | ]; |
| 256 | 256 | } |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | $record['thumbnail'] = $resArray->thumbnail; |
| 295 | 295 | $record['metadata'] = $metadata; |
| 296 | 296 | } else { |
| 297 | - $highlightedDoc = !empty($highlighting) ? $highlighting->getResult($resArray->id) : null; |
|
| 297 | + $highlightedDoc = !empty($highlighting) ? $highlighting->getResult($resArray->id) : NULL; |
|
| 298 | 298 | $highlight = !empty($highlightedDoc) ? $highlightedDoc->getField($fields['fulltext'])[0] : ''; |
| 299 | 299 | $record['subparts'][$resArray->id] = [ |
| 300 | 300 | 'uid' => $resArray->uid, |
@@ -600,10 +600,10 @@ discard block |
||
| 600 | 600 | // Add static fields. |
| 601 | 601 | $this->solrConfig['type'] = 'type'; |
| 602 | 602 | } else { |
| 603 | - return false; |
|
| 603 | + return FALSE; |
|
| 604 | 604 | } |
| 605 | 605 | } |
| 606 | - return true; |
|
| 606 | + return TRUE; |
|
| 607 | 607 | } |
| 608 | 608 | |
| 609 | 609 | /** |
@@ -616,7 +616,7 @@ discard block |
||
| 616 | 616 | * |
| 617 | 617 | * @return void |
| 618 | 618 | */ |
| 619 | - public function sort($by, $asc = true) |
|
| 619 | + public function sort($by, $asc = TRUE) |
|
| 620 | 620 | { |
| 621 | 621 | $newOrder = []; |
| 622 | 622 | $nonSortable = []; |
@@ -24,8 +24,7 @@ discard block |
||
| 24 | 24 | * @subpackage dlf |
| 25 | 25 | * @access public |
| 26 | 26 | */ |
| 27 | -class ResultDocument |
|
| 28 | -{ |
|
| 27 | +class ResultDocument { |
|
| 29 | 28 | |
| 30 | 29 | /** |
| 31 | 30 | * The identifier |
@@ -102,8 +101,7 @@ discard block |
||
| 102 | 101 | * |
| 103 | 102 | * @return void |
| 104 | 103 | */ |
| 105 | - public function __construct($record, $highlighting, $fields) |
|
| 106 | - { |
|
| 104 | + public function __construct($record, $highlighting, $fields) { |
|
| 107 | 105 | $this->id = $record[$fields['id']]; |
| 108 | 106 | $this->uid = $record[$fields['uid']]; |
| 109 | 107 | $this->page = $record[$fields['page']]; |
@@ -124,8 +122,7 @@ discard block |
||
| 124 | 122 | * |
| 125 | 123 | * @return string The result's record identifier |
| 126 | 124 | */ |
| 127 | - public function getId() |
|
| 128 | - { |
|
| 125 | + public function getId() { |
|
| 129 | 126 | return $this->id; |
| 130 | 127 | } |
| 131 | 128 | |
@@ -136,8 +133,7 @@ discard block |
||
| 136 | 133 | * |
| 137 | 134 | * @return string|null The result's record unified identifier |
| 138 | 135 | */ |
| 139 | - public function getUid() |
|
| 140 | - { |
|
| 136 | + public function getUid() { |
|
| 141 | 137 | return $this->uid; |
| 142 | 138 | } |
| 143 | 139 | |
@@ -148,8 +144,7 @@ discard block |
||
| 148 | 144 | * |
| 149 | 145 | * @return int The result's record page |
| 150 | 146 | */ |
| 151 | - public function getPage() |
|
| 152 | - { |
|
| 147 | + public function getPage() { |
|
| 153 | 148 | return $this->page; |
| 154 | 149 | } |
| 155 | 150 | |
@@ -160,8 +155,7 @@ discard block |
||
| 160 | 155 | * |
| 161 | 156 | * @return string All result's record snippets imploded to one string |
| 162 | 157 | */ |
| 163 | - public function getSnippets() |
|
| 164 | - { |
|
| 158 | + public function getSnippets() { |
|
| 165 | 159 | return $this->snippets; |
| 166 | 160 | } |
| 167 | 161 | |
@@ -172,8 +166,7 @@ discard block |
||
| 172 | 166 | * |
| 173 | 167 | * @return array(Page) All result's pages which contain search phrase |
| 174 | 168 | */ |
| 175 | - public function getPages() |
|
| 176 | - { |
|
| 169 | + public function getPages() { |
|
| 177 | 170 | return $this->pages; |
| 178 | 171 | } |
| 179 | 172 | |
@@ -184,8 +177,7 @@ discard block |
||
| 184 | 177 | * |
| 185 | 178 | * @return array(Region) All result's regions which contain search phrase |
| 186 | 179 | */ |
| 187 | - public function getRegions() |
|
| 188 | - { |
|
| 180 | + public function getRegions() { |
|
| 189 | 181 | return $this->regions; |
| 190 | 182 | } |
| 191 | 183 | |
@@ -196,8 +188,7 @@ discard block |
||
| 196 | 188 | * |
| 197 | 189 | * @return array(Highlight) All result's highlights of search phrase |
| 198 | 190 | */ |
| 199 | - public function getHighlights() |
|
| 200 | - { |
|
| 191 | + public function getHighlights() { |
|
| 201 | 192 | return $this->highlights; |
| 202 | 193 | } |
| 203 | 194 | |
@@ -208,8 +199,7 @@ discard block |
||
| 208 | 199 | * |
| 209 | 200 | * @return array(string) All result's highlights of search phrase |
| 210 | 201 | */ |
| 211 | - public function getHighlightsIds() |
|
| 212 | - { |
|
| 202 | + public function getHighlightsIds() { |
|
| 213 | 203 | $highlightsIds = []; |
| 214 | 204 | foreach ($this->highlights as $highlight) { |
| 215 | 205 | array_push($highlightsIds, $highlight->getId()); |
@@ -225,8 +215,7 @@ discard block |
||
| 225 | 215 | * |
| 226 | 216 | * @return void |
| 227 | 217 | */ |
| 228 | - private function parseSnippets() |
|
| 229 | - { |
|
| 218 | + private function parseSnippets() { |
|
| 230 | 219 | $snippetArray = $this->getArrayByIndex('text'); |
| 231 | 220 | |
| 232 | 221 | $this->snippets = !empty($snippetArray) ? implode(' [...] ', $snippetArray) : ''; |
@@ -240,8 +229,7 @@ discard block |
||
| 240 | 229 | * |
| 241 | 230 | * @return void |
| 242 | 231 | */ |
| 243 | - private function parsePages() |
|
| 244 | - { |
|
| 232 | + private function parsePages() { |
|
| 245 | 233 | $pageArray = $this->getArrayByIndex('pages'); |
| 246 | 234 | |
| 247 | 235 | $i = 0; |
@@ -261,8 +249,7 @@ discard block |
||
| 261 | 249 | * |
| 262 | 250 | * @return void |
| 263 | 251 | */ |
| 264 | - private function parseRegions() |
|
| 265 | - { |
|
| 252 | + private function parseRegions() { |
|
| 266 | 253 | $regionArray = $this->getArrayByIndex('regions'); |
| 267 | 254 | |
| 268 | 255 | $i = 0; |
@@ -282,8 +269,7 @@ discard block |
||
| 282 | 269 | * |
| 283 | 270 | * @return void |
| 284 | 271 | */ |
| 285 | - private function parseHighlights() |
|
| 286 | - { |
|
| 272 | + private function parseHighlights() { |
|
| 287 | 273 | $highlightArray = $this->getArrayByIndex('highlights'); |
| 288 | 274 | |
| 289 | 275 | foreach ($highlightArray as $highlights) { |
@@ -304,8 +290,7 @@ discard block |
||
| 304 | 290 | * |
| 305 | 291 | * @return array |
| 306 | 292 | */ |
| 307 | - private function getArrayByIndex($index) |
|
| 308 | - { |
|
| 293 | + private function getArrayByIndex($index) { |
|
| 309 | 294 | $objectArray = []; |
| 310 | 295 | foreach ($this->snippetsForRecord as $snippet) { |
| 311 | 296 | array_push($objectArray, $snippet[$index]); |
@@ -20,8 +20,7 @@ discard block |
||
| 20 | 20 | * @subpackage dlf |
| 21 | 21 | * @access public |
| 22 | 22 | */ |
| 23 | -class Region |
|
| 24 | -{ |
|
| 23 | +class Region { |
|
| 25 | 24 | |
| 26 | 25 | /** |
| 27 | 26 | * The identifier of the region |
@@ -105,8 +104,7 @@ discard block |
||
| 105 | 104 | * |
| 106 | 105 | * @return void |
| 107 | 106 | */ |
| 108 | - public function __construct($id, $region) |
|
| 109 | - { |
|
| 107 | + public function __construct($id, $region) { |
|
| 110 | 108 | $this->id = $id; |
| 111 | 109 | $this->pageId = $region['pageIdx']; |
| 112 | 110 | $this->xBeginPosition = $region['ulx']; |
@@ -125,8 +123,7 @@ discard block |
||
| 125 | 123 | * |
| 126 | 124 | * @return int The region's identifier |
| 127 | 125 | */ |
| 128 | - public function getId() |
|
| 129 | - { |
|
| 126 | + public function getId() { |
|
| 130 | 127 | return $this->id; |
| 131 | 128 | } |
| 132 | 129 | |
@@ -137,8 +134,7 @@ discard block |
||
| 137 | 134 | * |
| 138 | 135 | * @return int The region's page identifier |
| 139 | 136 | */ |
| 140 | - public function getPageId() |
|
| 141 | - { |
|
| 137 | + public function getPageId() { |
|
| 142 | 138 | return $this->pageId; |
| 143 | 139 | } |
| 144 | 140 | |
@@ -149,8 +145,7 @@ discard block |
||
| 149 | 145 | * |
| 150 | 146 | * @return int The region's horizontal beginning position |
| 151 | 147 | */ |
| 152 | - public function getXBeginPosition() |
|
| 153 | - { |
|
| 148 | + public function getXBeginPosition() { |
|
| 154 | 149 | return $this->xBeginPosition; |
| 155 | 150 | } |
| 156 | 151 | |
@@ -161,8 +156,7 @@ discard block |
||
| 161 | 156 | * |
| 162 | 157 | * @return int The region's horizontal ending position |
| 163 | 158 | */ |
| 164 | - public function getXEndPosition() |
|
| 165 | - { |
|
| 159 | + public function getXEndPosition() { |
|
| 166 | 160 | return $this->xEndPosition; |
| 167 | 161 | } |
| 168 | 162 | |
@@ -173,8 +167,7 @@ discard block |
||
| 173 | 167 | * |
| 174 | 168 | * @return int The region's vertical beginning position |
| 175 | 169 | */ |
| 176 | - public function getYBeginPosition() |
|
| 177 | - { |
|
| 170 | + public function getYBeginPosition() { |
|
| 178 | 171 | return $this->yBeginPosition; |
| 179 | 172 | } |
| 180 | 173 | |
@@ -185,8 +178,7 @@ discard block |
||
| 185 | 178 | * |
| 186 | 179 | * @return int The region's vertical ending position |
| 187 | 180 | */ |
| 188 | - public function getYEndPosition() |
|
| 189 | - { |
|
| 181 | + public function getYEndPosition() { |
|
| 190 | 182 | return $this->yEndPosition; |
| 191 | 183 | } |
| 192 | 184 | |
@@ -197,8 +189,7 @@ discard block |
||
| 197 | 189 | * |
| 198 | 190 | * @return int The region's width |
| 199 | 191 | */ |
| 200 | - public function getWidth() |
|
| 201 | - { |
|
| 192 | + public function getWidth() { |
|
| 202 | 193 | return $this->width; |
| 203 | 194 | } |
| 204 | 195 | |
@@ -209,8 +200,7 @@ discard block |
||
| 209 | 200 | * |
| 210 | 201 | * @return int The region's height |
| 211 | 202 | */ |
| 212 | - public function getHeight() |
|
| 213 | - { |
|
| 203 | + public function getHeight() { |
|
| 214 | 204 | return $this->height; |
| 215 | 205 | } |
| 216 | 206 | |
@@ -221,8 +211,7 @@ discard block |
||
| 221 | 211 | * |
| 222 | 212 | * @return string The region's text |
| 223 | 213 | */ |
| 224 | - public function getText() |
|
| 225 | - { |
|
| 214 | + public function getText() { |
|
| 226 | 215 | return $this->text; |
| 227 | 216 | } |
| 228 | 217 | } |
@@ -105,7 +105,7 @@ |
||
| 105 | 105 | $this->yEndPosition = $highlight['lry']; |
| 106 | 106 | $this->width = $highlight['lrx'] - $highlight['ulx']; |
| 107 | 107 | $this->height = $highlight['lry'] - $highlight['uly']; |
| 108 | - $this->id = $this->width . '_' . $this->height . '_' . $this->xBeginPosition . '_' . $this->yBeginPosition; |
|
| 108 | + $this->id = $this->width.'_'.$this->height.'_'.$this->xBeginPosition.'_'.$this->yBeginPosition; |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | /** |
@@ -20,8 +20,7 @@ discard block |
||
| 20 | 20 | * @subpackage dlf |
| 21 | 21 | * @access public |
| 22 | 22 | */ |
| 23 | -class Highlight |
|
| 24 | -{ |
|
| 23 | +class Highlight { |
|
| 25 | 24 | |
| 26 | 25 | /** |
| 27 | 26 | * The identifier in form 'w_h_x_y' |
@@ -96,8 +95,7 @@ discard block |
||
| 96 | 95 | * |
| 97 | 96 | * @return void |
| 98 | 97 | */ |
| 99 | - public function __construct($highlight) |
|
| 100 | - { |
|
| 98 | + public function __construct($highlight) { |
|
| 101 | 99 | $this->parentRegionId = $highlight['parentRegionIdx']; |
| 102 | 100 | $this->xBeginPosition = $highlight['ulx']; |
| 103 | 101 | $this->xEndPosition = $highlight['lrx']; |
@@ -115,8 +113,7 @@ discard block |
||
| 115 | 113 | * |
| 116 | 114 | * @return string The highlight's identifier |
| 117 | 115 | */ |
| 118 | - public function getId() |
|
| 119 | - { |
|
| 116 | + public function getId() { |
|
| 120 | 117 | return $this->id; |
| 121 | 118 | } |
| 122 | 119 | |
@@ -127,8 +124,7 @@ discard block |
||
| 127 | 124 | * |
| 128 | 125 | * @return int The highlight's horizontal beginning position |
| 129 | 126 | */ |
| 130 | - public function getXBeginPosition() |
|
| 131 | - { |
|
| 127 | + public function getXBeginPosition() { |
|
| 132 | 128 | return $this->xBeginPosition; |
| 133 | 129 | } |
| 134 | 130 | |
@@ -139,8 +135,7 @@ discard block |
||
| 139 | 135 | * |
| 140 | 136 | * @return int The highlight's horizontal ending position |
| 141 | 137 | */ |
| 142 | - public function getXEndPosition() |
|
| 143 | - { |
|
| 138 | + public function getXEndPosition() { |
|
| 144 | 139 | return $this->xEndPosition; |
| 145 | 140 | } |
| 146 | 141 | |
@@ -151,8 +146,7 @@ discard block |
||
| 151 | 146 | * |
| 152 | 147 | * @return int The highlight's vertical beginning position |
| 153 | 148 | */ |
| 154 | - public function getYBeginPosition() |
|
| 155 | - { |
|
| 149 | + public function getYBeginPosition() { |
|
| 156 | 150 | return $this->yBeginPosition; |
| 157 | 151 | } |
| 158 | 152 | |
@@ -163,8 +157,7 @@ discard block |
||
| 163 | 157 | * |
| 164 | 158 | * @return int The highlight's vertical ending position |
| 165 | 159 | */ |
| 166 | - public function getYEndPosition() |
|
| 167 | - { |
|
| 160 | + public function getYEndPosition() { |
|
| 168 | 161 | return $this->yEndPosition; |
| 169 | 162 | } |
| 170 | 163 | |
@@ -175,8 +168,7 @@ discard block |
||
| 175 | 168 | * |
| 176 | 169 | * @return int The highlight's width |
| 177 | 170 | */ |
| 178 | - public function getWidth() |
|
| 179 | - { |
|
| 171 | + public function getWidth() { |
|
| 180 | 172 | return $this->width; |
| 181 | 173 | } |
| 182 | 174 | |
@@ -187,8 +179,7 @@ discard block |
||
| 187 | 179 | * |
| 188 | 180 | * @return int The highlight's height |
| 189 | 181 | */ |
| 190 | - public function getHeight() |
|
| 191 | - { |
|
| 182 | + public function getHeight() { |
|
| 192 | 183 | return $this->height; |
| 193 | 184 | } |
| 194 | 185 | } |
@@ -20,8 +20,7 @@ discard block |
||
| 20 | 20 | * @subpackage dlf |
| 21 | 21 | * @access public |
| 22 | 22 | */ |
| 23 | -class Page |
|
| 24 | -{ |
|
| 23 | +class Page { |
|
| 25 | 24 | |
| 26 | 25 | /** |
| 27 | 26 | * The identifier of the page |
@@ -65,8 +64,7 @@ discard block |
||
| 65 | 64 | * |
| 66 | 65 | * @return void |
| 67 | 66 | */ |
| 68 | - public function __construct($id, $page) |
|
| 69 | - { |
|
| 67 | + public function __construct($id, $page) { |
|
| 70 | 68 | $this->id = $id; |
| 71 | 69 | $this->name = $page['id']; |
| 72 | 70 | $this->width = $page['width']; |
@@ -80,8 +78,7 @@ discard block |
||
| 80 | 78 | * |
| 81 | 79 | * @return int The page's identifier |
| 82 | 80 | */ |
| 83 | - public function getId() |
|
| 84 | - { |
|
| 81 | + public function getId() { |
|
| 85 | 82 | return $this->id; |
| 86 | 83 | } |
| 87 | 84 | |
@@ -92,8 +89,7 @@ discard block |
||
| 92 | 89 | * |
| 93 | 90 | * @return string The page's name |
| 94 | 91 | */ |
| 95 | - public function getName() |
|
| 96 | - { |
|
| 92 | + public function getName() { |
|
| 97 | 93 | return $this->name; |
| 98 | 94 | } |
| 99 | 95 | |
@@ -104,8 +100,7 @@ discard block |
||
| 104 | 100 | * |
| 105 | 101 | * @return int The page's width |
| 106 | 102 | */ |
| 107 | - public function getWidth() |
|
| 108 | - { |
|
| 103 | + public function getWidth() { |
|
| 109 | 104 | return $this->width; |
| 110 | 105 | } |
| 111 | 106 | |
@@ -116,8 +111,7 @@ discard block |
||
| 116 | 111 | * |
| 117 | 112 | * @return int The page's height |
| 118 | 113 | */ |
| 119 | - public function getHeight() |
|
| 120 | - { |
|
| 114 | + public function getHeight() { |
|
| 121 | 115 | return $this->height; |
| 122 | 116 | } |
| 123 | 117 | } |
@@ -37,8 +37,7 @@ discard block |
||
| 37 | 37 | * @property-read bool $ready Is the Solr service instantiated successfully? |
| 38 | 38 | * @property-read \Solarium\Client $service This holds the Solr service object |
| 39 | 39 | */ |
| 40 | -class Solr implements LoggerAwareInterface |
|
| 41 | -{ |
|
| 40 | +class Solr implements LoggerAwareInterface { |
|
| 42 | 41 | use LoggerAwareTrait; |
| 43 | 42 | |
| 44 | 43 | /** |
@@ -130,8 +129,7 @@ discard block |
||
| 130 | 129 | * |
| 131 | 130 | * @return string The name of the new core |
| 132 | 131 | */ |
| 133 | - public static function createCore($core = '') |
|
| 134 | - { |
|
| 132 | + public static function createCore($core = '') { |
|
| 135 | 133 | // Get next available core name if none given. |
| 136 | 134 | if (empty($core)) { |
| 137 | 135 | $core = 'dlfCore' . self::getNextCoreNumber(); |
@@ -178,8 +176,7 @@ discard block |
||
| 178 | 176 | * |
| 179 | 177 | * @return string The escaped query string |
| 180 | 178 | */ |
| 181 | - public static function escapeQuery($query) |
|
| 182 | - { |
|
| 179 | + public static function escapeQuery($query) { |
|
| 183 | 180 | $helper = GeneralUtility::makeInstance(\Solarium\Core\Query\Helper::class); |
| 184 | 181 | // Escape query phrase or term. |
| 185 | 182 | if (preg_match('/^".*"$/', $query)) { |
@@ -202,8 +199,7 @@ discard block |
||
| 202 | 199 | * |
| 203 | 200 | * @return string The escaped query string |
| 204 | 201 | */ |
| 205 | - public static function escapeQueryKeepField($query, $pid) |
|
| 206 | - { |
|
| 202 | + public static function escapeQueryKeepField($query, $pid) { |
|
| 207 | 203 | // Is there a field query? |
| 208 | 204 | if (preg_match('/^[[:alnum:]]+_[tu][su]i:\(?.*\)?$/', $query)) { |
| 209 | 205 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
@@ -253,8 +249,7 @@ discard block |
||
| 253 | 249 | * |
| 254 | 250 | * @return array fields |
| 255 | 251 | */ |
| 256 | - public static function getFields() |
|
| 257 | - { |
|
| 252 | + public static function getFields() { |
|
| 258 | 253 | $conf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][self::$extKey]); |
| 259 | 254 | |
| 260 | 255 | $fields = []; |
@@ -296,8 +291,7 @@ discard block |
||
| 296 | 291 | * |
| 297 | 292 | * @return \Kitodo\Dlf\Common\Solr Instance of this class |
| 298 | 293 | */ |
| 299 | - public static function getInstance($core = null) |
|
| 300 | - { |
|
| 294 | + public static function getInstance($core = null) { |
|
| 301 | 295 | $logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(__CLASS__); |
| 302 | 296 | |
| 303 | 297 | // Get core name if UID is given. |
@@ -339,8 +333,7 @@ discard block |
||
| 339 | 333 | * |
| 340 | 334 | * @return int First unused core number found |
| 341 | 335 | */ |
| 342 | - public static function getNextCoreNumber($number = 0) |
|
| 343 | - { |
|
| 336 | + public static function getNextCoreNumber($number = 0) { |
|
| 344 | 337 | $number = max(intval($number), 0); |
| 345 | 338 | // Check if core already exists. |
| 346 | 339 | $solr = self::getInstance('dlfCore' . $number); |
@@ -358,8 +351,7 @@ discard block |
||
| 358 | 351 | * |
| 359 | 352 | * @return void |
| 360 | 353 | */ |
| 361 | - protected function loadSolrConnectionInfo() |
|
| 362 | - { |
|
| 354 | + protected function loadSolrConnectionInfo() { |
|
| 363 | 355 | if (empty($this->config)) { |
| 364 | 356 | $config = []; |
| 365 | 357 | // Extract extension configuration. |
@@ -397,8 +389,7 @@ discard block |
||
| 397 | 389 | * |
| 398 | 390 | * @return \Kitodo\Dlf\Common\DocumentList The result list |
| 399 | 391 | */ |
| 400 | - public function search() |
|
| 401 | - { |
|
| 392 | + public function search() { |
|
| 402 | 393 | $toplevel = []; |
| 403 | 394 | // Take over query parameters. |
| 404 | 395 | $params = $this->params; |
@@ -467,8 +458,7 @@ discard block |
||
| 467 | 458 | * |
| 468 | 459 | * @return array The Apache Solr Documents that were fetched |
| 469 | 460 | */ |
| 470 | - public function search_raw($query = '', $parameters = []) |
|
| 471 | - { |
|
| 461 | + public function search_raw($query = '', $parameters = []) { |
|
| 472 | 462 | // Set additional query parameters. |
| 473 | 463 | $parameters['start'] = 0; |
| 474 | 464 | $parameters['rows'] = $this->limit; |
@@ -500,8 +490,7 @@ discard block |
||
| 500 | 490 | * |
| 501 | 491 | * @return string|null The core name of the current query endpoint or null if core admin endpoint |
| 502 | 492 | */ |
| 503 | - protected function _getCore() |
|
| 504 | - { |
|
| 493 | + protected function _getCore() { |
|
| 505 | 494 | return $this->core; |
| 506 | 495 | } |
| 507 | 496 | |
@@ -512,8 +501,7 @@ discard block |
||
| 512 | 501 | * |
| 513 | 502 | * @return int The max number of results |
| 514 | 503 | */ |
| 515 | - protected function _getLimit() |
|
| 516 | - { |
|
| 504 | + protected function _getLimit() { |
|
| 517 | 505 | return $this->limit; |
| 518 | 506 | } |
| 519 | 507 | |
@@ -524,8 +512,7 @@ discard block |
||
| 524 | 512 | * |
| 525 | 513 | * @return int Total number of hits for last search |
| 526 | 514 | */ |
| 527 | - protected function _getNumberOfHits() |
|
| 528 | - { |
|
| 515 | + protected function _getNumberOfHits() { |
|
| 529 | 516 | return $this->numberOfHits; |
| 530 | 517 | } |
| 531 | 518 | |
@@ -536,8 +523,7 @@ discard block |
||
| 536 | 523 | * |
| 537 | 524 | * @return bool Is the search instantiated successfully? |
| 538 | 525 | */ |
| 539 | - protected function _getReady() |
|
| 540 | - { |
|
| 526 | + protected function _getReady() { |
|
| 541 | 527 | return $this->ready; |
| 542 | 528 | } |
| 543 | 529 | |
@@ -548,8 +534,7 @@ discard block |
||
| 548 | 534 | * |
| 549 | 535 | * @return \Solarium\Client Apache Solr service object |
| 550 | 536 | */ |
| 551 | - protected function _getService() |
|
| 552 | - { |
|
| 537 | + protected function _getService() { |
|
| 553 | 538 | return $this->service; |
| 554 | 539 | } |
| 555 | 540 | |
@@ -562,8 +547,7 @@ discard block |
||
| 562 | 547 | * |
| 563 | 548 | * @return void |
| 564 | 549 | */ |
| 565 | - protected function _setCPid($value) |
|
| 566 | - { |
|
| 550 | + protected function _setCPid($value) { |
|
| 567 | 551 | $this->cPid = max(intval($value), 0); |
| 568 | 552 | } |
| 569 | 553 | |
@@ -576,8 +560,7 @@ discard block |
||
| 576 | 560 | * |
| 577 | 561 | * @return void |
| 578 | 562 | */ |
| 579 | - protected function _setLimit($value) |
|
| 580 | - { |
|
| 563 | + protected function _setLimit($value) { |
|
| 581 | 564 | $this->limit = max(intval($value), 0); |
| 582 | 565 | } |
| 583 | 566 | |
@@ -590,8 +573,7 @@ discard block |
||
| 590 | 573 | * |
| 591 | 574 | * @return void |
| 592 | 575 | */ |
| 593 | - protected function _setParams(array $value) |
|
| 594 | - { |
|
| 576 | + protected function _setParams(array $value) { |
|
| 595 | 577 | $this->params = $value; |
| 596 | 578 | } |
| 597 | 579 | |
@@ -604,8 +586,7 @@ discard block |
||
| 604 | 586 | * |
| 605 | 587 | * @return mixed Value of $this->$var |
| 606 | 588 | */ |
| 607 | - public function __get($var) |
|
| 608 | - { |
|
| 589 | + public function __get($var) { |
|
| 609 | 590 | $method = '_get' . ucfirst($var); |
| 610 | 591 | if ( |
| 611 | 592 | !property_exists($this, $var) |
@@ -627,8 +608,7 @@ discard block |
||
| 627 | 608 | * |
| 628 | 609 | * @return bool true if variable is set and not empty, false otherwise |
| 629 | 610 | */ |
| 630 | - public function __isset($var) |
|
| 631 | - { |
|
| 611 | + public function __isset($var) { |
|
| 632 | 612 | return !empty($this->__get($var)); |
| 633 | 613 | } |
| 634 | 614 | |
@@ -642,8 +622,7 @@ discard block |
||
| 642 | 622 | * |
| 643 | 623 | * @return void |
| 644 | 624 | */ |
| 645 | - public function __set($var, $value) |
|
| 646 | - { |
|
| 625 | + public function __set($var, $value) { |
|
| 647 | 626 | $method = '_set' . ucfirst($var); |
| 648 | 627 | if ( |
| 649 | 628 | !property_exists($this, $var) |
@@ -664,8 +643,7 @@ discard block |
||
| 664 | 643 | * |
| 665 | 644 | * @return void |
| 666 | 645 | */ |
| 667 | - protected function __construct($core) |
|
| 668 | - { |
|
| 646 | + protected function __construct($core) { |
|
| 669 | 647 | // Get Solr connection parameters from configuration. |
| 670 | 648 | $this->loadSolrConnectionInfo(); |
| 671 | 649 | // Configure connection adapter. |