Complex classes like TypoScriptConfiguration often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use TypoScriptConfiguration, and based on these observations, apply Extract Interface, too.
| 1 | <?php | ||
| 63 | class TypoScriptConfiguration | ||
| 64 | { | ||
| 65 | /** | ||
| 66 | * @var \ApacheSolrForTypo3\Solr\System\Util\ArrayAccessor|null | ||
| 67 | */ | ||
| 68 | protected $configurationAccess = null; | ||
| 69 | |||
| 70 | /** | ||
| 71 | * Holds the pageId in which context the configuration was parsed | ||
| 72 | * (normally $GLOBALS['TSFE']->id) | ||
| 73 | */ | ||
| 74 | protected $contextPageId = 0; | ||
| 75 | |||
| 76 | /** | ||
| 77 | * @var ContentObjectService | ||
| 78 | */ | ||
| 79 | protected $contentObjectService; | ||
| 80 | |||
| 81 | /** | ||
| 82 | * @param array $configuration | ||
| 83 | * @param int $contextPageId | ||
| 84 | * @param ContentObjectService $contentObjectService | ||
| 85 | */ | ||
| 86 | 222 | public function __construct(array $configuration, $contextPageId = 0, ContentObjectService $contentObjectService = null) | |
| 92 | |||
| 93 | /** | ||
| 94 | * Checks if a value is 1, '1', 'true' | ||
| 95 | * @param mixed $value | ||
| 96 | * @return bool | ||
| 97 | */ | ||
| 98 | 206 | protected function getBool($value) | |
| 102 | |||
| 103 | /** | ||
| 104 | * This method can be used to only retrieve array keys where the value is not an array. | ||
| 105 | * | ||
| 106 | * This can be very handy in the configuration when only keys should ne taken into account | ||
| 107 | * where the value is not a subconfiguration (typically an typoscript object path). | ||
| 108 | * | ||
| 109 | * @param $inputArray | ||
| 110 | * @return array | ||
| 111 | */ | ||
| 112 | 8 | protected function getOnlyArrayKeysWhereValueIsNotAnArray($inputArray) | |
| 127 | |||
| 128 | /** | ||
| 129 | * Gets the value from a given TypoScript path. | ||
| 130 | * | ||
| 131 | * In the context of an frontend content element the path plugin.tx_solr is | ||
| 132 | * merged recursive with overrule with the content element specific typoscript | ||
| 133 | * settings, like plugin.tx_solr_PiResults_Results, and possible flex form settings | ||
| 134 | * (depends on the solr plugin). | ||
| 135 | * | ||
| 136 | * Example: plugin.tx_solr.search.targetPage | ||
| 137 | * returns $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_solr.']['search.']['targetPage'] | ||
| 138 | * | ||
| 139 | * @param string $path TypoScript path | ||
| 140 | * @return mixed The TypoScript object defined by the given path | ||
| 141 | * @throws InvalidArgumentException | ||
| 142 | */ | ||
| 143 | 243 | public function getValueByPath($path) | |
| 144 |     { | ||
| 145 | 243 |         if (!is_string($path)) { | |
| 146 |             throw new InvalidArgumentException('Parameter $path is not a string', | ||
| 147 | 1325623321); | ||
| 148 | } | ||
| 149 | 243 | return $this->configurationAccess->get($path); | |
| 150 | } | ||
| 151 | |||
| 152 | /** | ||
| 153 | * This method can be used to get a configuration value by path if it exists or return a | ||
| 154 | * default value when it does not exist. | ||
| 155 | * | ||
| 156 | * @param string $path | ||
| 157 | * @param mixed $defaultValue | ||
| 158 | * @return mixed | ||
| 159 | */ | ||
| 160 | 240 | public function getValueByPathOrDefaultValue($path, $defaultValue) | |
| 161 |     { | ||
| 162 | 240 | $value = $this->getValueByPath($path); | |
| 163 | 240 |         if (is_null($value)) { | |
| 164 | 225 | return $defaultValue; | |
| 165 | } | ||
| 166 | |||
| 167 | 175 | return $value; | |
| 168 | } | ||
| 169 | |||
| 170 | /** | ||
| 171 | * Gets the parent TypoScript Object from a given TypoScript path. | ||
| 172 | * | ||
| 173 | * In the context of an frontend content element the path plugin.tx_solr is | ||
| 174 | * merged recursive with overrule with the content element specific typoscript | ||
| 175 | * settings, like plugin.tx_solr_PiResults_Results, and possible flex form settings | ||
| 176 | * (depends on the solr plugin). | ||
| 177 | * | ||
| 178 | * Example: plugin.tx_solr.index.queue.tt_news.fields.content | ||
| 179 | * returns $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_solr.']['index.']['queue.']['tt_news.']['fields.']['content.'] | ||
| 180 | * which is a SOLR_CONTENT cObj. | ||
| 181 | * | ||
| 182 | * @param string $path TypoScript path | ||
| 183 | * @return array The TypoScript object defined by the given path | ||
| 184 | * @throws InvalidArgumentException | ||
| 185 | */ | ||
| 186 | 134 | public function getObjectByPath($path) | |
| 187 |     { | ||
| 188 | 134 |         if (substr($path, -1) !== '.') { | |
| 189 | 4 | $path = rtrim($path, '.'); | |
| 190 | 4 | $path = substr($path, 0, strrpos($path, '.') + 1); | |
| 191 | } | ||
| 192 | |||
| 193 | 134 |         if (!is_string($path)) { | |
| 194 |             throw new InvalidArgumentException('Parameter $path is not a string', 1325627243); | ||
| 195 | } | ||
| 196 | |||
| 197 | 134 | return $this->configurationAccess->get($path); | |
| 198 | } | ||
| 199 | |||
| 200 | /** | ||
| 201 | * Gets the parent TypoScript Object from a given TypoScript path and if not present return | ||
| 202 | * the default value | ||
| 203 | * | ||
| 204 | * @see getObjectByPath | ||
| 205 | * @param string $path | ||
| 206 | * @param array $defaultValue | ||
| 207 | * @return array | ||
| 208 | */ | ||
| 209 | 126 | public function getObjectByPathOrDefault($path, array $defaultValue) | |
| 210 |     { | ||
| 211 |         try { | ||
| 212 | 126 | $object = $this->getObjectByPath($path); | |
| 213 |         } catch (\InvalidArgumentException $e) { | ||
| 214 | return $defaultValue; | ||
| 215 | } | ||
| 216 | |||
| 217 | 126 |         if (!is_array($object)) { | |
| 218 | 46 | return $defaultValue; | |
| 219 | } | ||
| 220 | |||
| 221 | 113 | return $object; | |
| 222 | } | ||
| 223 | |||
| 224 | /** | ||
| 225 | * Checks whether a given TypoScript path is valid. | ||
| 226 | * | ||
| 227 | * @param string $path TypoScript path | ||
| 228 | * @return bool TRUE if the path resolves, FALSE otherwise | ||
| 229 | */ | ||
| 230 | public function isValidPath($path) | ||
| 231 |     { | ||
| 232 | $isValidPath = false; | ||
| 233 | |||
| 234 | $pathValue = $this->getValueByPath($path); | ||
| 235 |         if (!is_null($pathValue)) { | ||
| 236 | $isValidPath = true; | ||
| 237 | } | ||
| 238 | |||
| 239 | return $isValidPath; | ||
| 240 | } | ||
| 241 | |||
| 242 | /** | ||
| 243 | * Merges a configuration with another configuration a | ||
| 244 | * | ||
| 245 | * @param array $configurationToMerge | ||
| 246 | * @param bool $addKeys If set to FALSE, keys that are NOT found in $original will not be set. Thus only existing value can/will be overruled from overrule array. | ||
| 247 | * @param bool $includeEmptyValues If set, values from $overrule will overrule if they are empty or zero. | ||
| 248 | * @param bool $enableUnsetFeature If set, special values "__UNSET" can be used in the overrule array in order to unset array keys in the original array. | ||
| 249 | * @return TypoScriptConfiguration | ||
| 250 | */ | ||
| 251 | 27 | public function mergeSolrConfiguration(array $configurationToMerge, $addKeys = true, $includeEmptyValues = true, $enableUnsetFeature = true) | |
| 252 |     { | ||
| 253 | 27 | $data = $this->configurationAccess->getData(); | |
| 254 | 27 | ArrayUtility::mergeRecursiveWithOverrule( | |
| 255 | 27 | $data['plugin.']['tx_solr.'], | |
| 256 | $configurationToMerge, | ||
| 257 | $addKeys, | ||
| 258 | $includeEmptyValues, | ||
| 259 | $enableUnsetFeature | ||
| 260 | ); | ||
| 261 | |||
| 262 | 27 | $this->configurationAccess->setData($data); | |
| 263 | |||
| 264 | 27 | return $this; | |
| 265 | } | ||
| 266 | |||
| 267 | /** | ||
| 268 | * Returns true when ext_solr is enabled | ||
| 269 | * | ||
| 270 | * @param boolean $defaultIfEmpty | ||
| 271 | * @return boolean | ||
| 272 | */ | ||
| 273 | 3 | public function getEnabled($defaultIfEmpty = false) | |
| 274 |     { | ||
| 275 | 3 | $path = 'plugin.tx_solr.enabled'; | |
| 276 | 3 | $result = $this->getValueByPathOrDefaultValue($path, $defaultIfEmpty); | |
| 277 | 3 | return $this->getBool($result); | |
| 278 | } | ||
| 279 | |||
| 280 | /** | ||
| 281 | * Returns the configured css file for a specific fileKey. | ||
| 282 | * | ||
| 283 | * plugin.tx_solr.cssFiles.<fileKey> | ||
| 284 | * | ||
| 285 | * @param string $fileKey | ||
| 286 | * @param string $defaultIfEmpty | ||
| 287 | * @return string | ||
| 288 | */ | ||
| 289 | 25 | public function getCssFileByFileKey($fileKey, $defaultIfEmpty = '') | |
| 290 |     { | ||
| 291 | 25 |         $cssFileName = $this->getValueByPathOrDefaultValue('plugin.tx_solr.cssFiles.' . $fileKey, $defaultIfEmpty); | |
| 292 | 25 | return (string)$cssFileName; | |
| 293 | } | ||
| 294 | |||
| 295 | /** | ||
| 296 | * Returns the configured additionalFields configured for the indexing. | ||
| 297 | * | ||
| 298 | * plugin.tx_solr.index.additionalFields. | ||
| 299 | * | ||
| 300 | * @param array $defaultIfEmpty | ||
| 301 | * @return array | ||
| 302 | */ | ||
| 303 | 3 | public function getIndexAdditionalFieldsConfiguration($defaultIfEmpty = []) | |
| 304 |     { | ||
| 305 | 3 |         $result = $this->getObjectByPathOrDefault('plugin.tx_solr.index.additionalFields.', $defaultIfEmpty); | |
| 306 | 3 | return $result; | |
| 307 | } | ||
| 308 | |||
| 309 | /** | ||
| 310 | * Returns all solr fields names where a mapping is configured in index.additionalFields | ||
| 311 | * | ||
| 312 | * Returns all keys from | ||
| 313 | * plugin.tx_solr.index.additionalFields. | ||
| 314 | * | ||
| 315 | * @param array $defaultIfEmpty | ||
| 316 | * @return array | ||
| 317 | */ | ||
| 318 | 2 | public function getIndexMappedAdditionalFieldNames($defaultIfEmpty = []) | |
| 319 |     { | ||
| 320 | 2 | $mappingConfiguration = $this->getIndexAdditionalFieldsConfiguration(); | |
| 321 | 2 | $mappedFieldNames = $this->getOnlyArrayKeysWhereValueIsNotAnArray($mappingConfiguration); | |
| 322 | 2 | return count($mappedFieldNames) == 0 ? $defaultIfEmpty : $mappedFieldNames; | |
| 323 | } | ||
| 324 | |||
| 325 | /** | ||
| 326 | * Returns the fieldProcessingInstructions configuration array | ||
| 327 | * | ||
| 328 | * plugin.tx_solr.index.fieldProcessingInstructions. | ||
| 329 | * | ||
| 330 | * @param array $defaultIfEmpty | ||
| 331 | * @return array | ||
| 332 | */ | ||
| 333 | 53 | public function getIndexFieldProcessingInstructionsConfiguration(array $defaultIfEmpty = []) | |
| 334 |     { | ||
| 335 | 53 |         $result = $this->getObjectByPathOrDefault('plugin.tx_solr.index.fieldProcessingInstructions.', $defaultIfEmpty); | |
| 336 | 53 | return $result; | |
| 337 | } | ||
| 338 | |||
| 339 | /** | ||
| 340 | * Retrieves the indexing configuration array for an indexing queue by configuration name. | ||
| 341 | * | ||
| 342 | * plugin.tx_solr.index.queue.<configurationName>. | ||
| 343 | * | ||
| 344 | * @param string $configurationName | ||
| 345 | * @param array $defaultIfEmpty | ||
| 346 | * @return array | ||
| 347 | */ | ||
| 348 | 5 | public function getIndexQueueConfigurationByName($configurationName, array $defaultIfEmpty = []) | |
| 349 |     { | ||
| 350 | 5 | $path = 'plugin.tx_solr.index.queue.' . $configurationName . '.'; | |
| 351 | 5 | $result = $this->getObjectByPathOrDefault($path, $defaultIfEmpty); | |
| 352 | 5 | return $result; | |
| 353 | } | ||
| 354 | |||
| 355 | /** | ||
| 356 | * Returns an array of all additionalPageIds by index configuration name. | ||
| 357 | * | ||
| 358 | * plugin.tx_solr.index.queue.pages.additionalPageIds | ||
| 359 | * | ||
| 360 | * @param string $configurationName | ||
| 361 | * @param array $defaultIfEmpty | ||
| 362 | * @return array | ||
| 363 | */ | ||
| 364 | 42 | public function getIndexQueueAdditionalPageIdsByConfigurationName($configurationName = 'pages', $defaultIfEmpty = []) | |
| 365 |     { | ||
| 366 | 42 | $path = 'plugin.tx_solr.index.queue.' . $configurationName . '.additionalPageIds'; | |
| 367 | 42 | $result = $this->getValueByPathOrDefaultValue($path, ''); | |
| 368 | 42 |         if (trim($result) == '') { | |
| 369 | 40 | return $defaultIfEmpty; | |
| 370 | } | ||
| 371 | |||
| 372 | 2 |         return GeneralUtility::trimExplode(',', $result); | |
| 373 | } | ||
| 374 | |||
| 375 | /** | ||
| 376 | * Returns an array of all allowedPageTypes. | ||
| 377 | * | ||
| 378 | * plugin.tx_solr.index.queue.pages.allowedPageTypes | ||
| 379 | * | ||
| 380 | * @param string $configurationName The configuration name of the queue to use. | ||
| 381 | * @param array $defaultIfEmpty | ||
| 382 | * @return array | ||
| 383 | */ | ||
| 384 | 28 | public function getIndexQueueAllowedPageTypesArrayByConfigurationName($configurationName = 'pages', $defaultIfEmpty = []) | |
| 385 |     { | ||
| 386 | 28 | $path = 'plugin.tx_solr.index.queue.' . $configurationName . '.allowedPageTypes'; | |
| 387 | 28 | $result = $this->getValueByPathOrDefaultValue($path, ''); | |
| 388 | 28 |         if (trim($result) == '') { | |
| 389 | return $defaultIfEmpty; | ||
| 390 | } | ||
| 391 | |||
| 392 | 28 |         return GeneralUtility::trimExplode(',', $result); | |
| 393 | } | ||
| 394 | |||
| 395 | /** | ||
| 396 | * Returns an array of all allowedPageTypes. | ||
| 397 | * | ||
| 398 | * plugin.tx_solr.index.queue.pages.allowedPageTypes | ||
| 399 | * | ||
| 400 | * @deprecated since 6.0 will be removed in 7.0 | ||
| 401 | * | ||
| 402 | * @param array $defaultIfEmpty | ||
| 403 | * @return array | ||
| 404 | */ | ||
| 405 | 1 | public function getIndexQueuePagesAllowedPageTypesArray($defaultIfEmpty = []) | |
| 406 |     { | ||
| 407 | 1 | return $this->getIndexQueueAllowedPageTypesArrayByConfigurationName( | |
| 408 | 1 | 'pages', | |
| 409 | $defaultIfEmpty | ||
| 410 | ); | ||
| 411 | } | ||
| 412 | |||
| 413 | /** | ||
| 414 | * Returns the configured excludeContentByClass patterns as array. | ||
| 415 | * | ||
| 416 | * plugin.tx_solr.index.queue.pages.excludeContentByClass | ||
| 417 | * | ||
| 418 | * @param array $defaultIfEmpty | ||
| 419 | * @return array | ||
| 420 | */ | ||
| 421 | 36 | public function getIndexQueuePagesExcludeContentByClassArray($defaultIfEmpty = []) | |
| 422 |     { | ||
| 423 | 36 | $path = 'plugin.tx_solr.index.queue.pages.excludeContentByClass'; | |
| 424 | 36 | $result = $this->getValueByPathOrDefaultValue($path, ''); | |
| 425 | |||
| 426 | 36 |         if (trim($result) == '') { | |
| 427 | 6 | return $defaultIfEmpty; | |
| 428 | } | ||
| 429 | |||
| 430 | 30 |         return GeneralUtility::trimExplode(',', $result); | |
| 431 | } | ||
| 432 | |||
| 433 | /** | ||
| 434 | * Returns the configured database table for an indexing queue configuration or | ||
| 435 | * the configurationName itself that is used by convention as tableName when no | ||
| 436 | * other tablename is present. | ||
| 437 | * | ||
| 438 | * plugin.tx_solr.index.queue.<configurationName>.table or configurationName | ||
| 439 | * | ||
| 440 | * @param string $configurationName | ||
| 441 | * @return string | ||
| 442 | */ | ||
| 443 | 55 | public function getIndexQueueTableNameOrFallbackToConfigurationName($configurationName = '') | |
| 444 |     { | ||
| 445 | 55 | $path = 'plugin.tx_solr.index.queue.' . $configurationName . '.table'; | |
| 446 | 55 | $result = $this->getValueByPathOrDefaultValue($path, $configurationName); | |
| 447 | 55 | return $result; | |
| 448 | } | ||
| 449 | |||
| 450 | /** | ||
| 451 | * Returns the field configuration for a specific index queue. | ||
| 452 | * | ||
| 453 | * plugin.tx_solr.index.queue.<configurationName>.fields. | ||
| 454 | * | ||
| 455 | * @param string $configurationName | ||
| 456 | * @param array $defaultIfEmpty | ||
| 457 | * @return array | ||
| 458 | */ | ||
| 459 | 19 | public function getIndexQueueFieldsConfigurationByConfigurationName($configurationName = '', $defaultIfEmpty = []) | |
| 460 |     { | ||
| 461 | 19 | $path = 'plugin.tx_solr.index.queue.' . $configurationName . '.fields.'; | |
| 462 | 19 | $result = $this->getObjectByPathOrDefault($path, $defaultIfEmpty); | |
| 463 | 19 | return $result; | |
| 464 | } | ||
| 465 | |||
| 466 | /** | ||
| 467 | * Gets an array of tables configured for indexing by the Index Queue. Since the | ||
| 468 | * record monitor must watch these tables for manipulation. | ||
| 469 | * | ||
| 470 | * @return array Array of table names to be watched by the record monitor. | ||
| 471 | */ | ||
| 472 | 31 | public function getIndexQueueMonitoredTables() | |
| 473 |     { | ||
| 474 | 31 | $monitoredTables = []; | |
| 475 | |||
| 476 | 31 | $indexingConfigurations = $this->getEnabledIndexQueueConfigurationNames(); | |
| 477 | 31 |         foreach ($indexingConfigurations as $indexingConfigurationName) { | |
| 478 | 31 | $monitoredTable = $this->getIndexQueueTableNameOrFallbackToConfigurationName($indexingConfigurationName); | |
| 479 | 31 | $monitoredTables[] = $monitoredTable; | |
| 480 | 31 |             if ($monitoredTable == 'pages') { | |
| 481 | // when monitoring pages, also monitor creation of translations | ||
| 482 | 31 | $monitoredTables[] = 'pages_language_overlay'; | |
| 483 | } | ||
| 484 | } | ||
| 485 | |||
| 486 | 31 | return array_values(array_unique($monitoredTables)); | |
| 487 | } | ||
| 488 | |||
| 489 | /** | ||
| 490 | * This method can be used to check if a table is configured to be monitored by the record monitor. | ||
| 491 | * | ||
| 492 | * @param string $tableName | ||
| 493 | * @return bool | ||
| 494 | */ | ||
| 495 | 30 | public function getIndexQueueIsMonitoredTable($tableName) | |
| 496 |     { | ||
| 497 | 30 | return in_array($tableName, $this->getIndexQueueMonitoredTables(), true); | |
| 498 | } | ||
| 499 | |||
| 500 | /** | ||
| 501 | * Returns the configured indexer class that should be used for a certain indexingConfiguration. | ||
| 502 | * By default "ApacheSolrForTypo3\Solr\IndexQueue\Indexer" will be returned. | ||
| 503 | * | ||
| 504 | * plugin.tx_solr.index.queue.<configurationName>.indexer | ||
| 505 | * | ||
| 506 | * @param string $configurationName | ||
| 507 | * @param string $defaultIfEmpty | ||
| 508 | * @return string | ||
| 509 | */ | ||
| 510 | 6 | public function getIndexQueueIndexerByConfigurationName($configurationName, $defaultIfEmpty = Indexer::class) | |
| 511 |     { | ||
| 512 | 6 | $path = 'plugin.tx_solr.index.queue.' . $configurationName . '.indexer'; | |
| 513 | 6 | $result = $this->getValueByPathOrDefaultValue($path, $defaultIfEmpty); | |
| 514 | 6 | return $result; | |
| 515 | } | ||
| 516 | |||
| 517 | /** | ||
| 518 | * Returns the configuration of an indexer for a special indexingConfiguration. By default an empty | ||
| 519 | * array is returned. | ||
| 520 | * | ||
| 521 | * plugin.tx_solr.index.queue.<configurationName>.indexer. | ||
| 522 | * | ||
| 523 | * @param string $configurationName | ||
| 524 | * @param array $defaultIfEmpty | ||
| 525 | * @return array | ||
| 526 | */ | ||
| 527 | 6 | public function getIndexQueueIndexerConfigurationByConfigurationName($configurationName, $defaultIfEmpty = []) | |
| 528 |     { | ||
| 529 | 6 | $path = 'plugin.tx_solr.index.queue.' . $configurationName . '.indexer.'; | |
| 530 | 6 | $result = $this->getObjectByPathOrDefault($path, $defaultIfEmpty); | |
| 531 | 6 | return $result; | |
| 532 | } | ||
| 533 | |||
| 534 | /** | ||
| 535 | * Returns all solr fields names where a mapping configuration is set for a certain index configuration | ||
| 536 | * | ||
| 537 | * Returns all keys from | ||
| 538 | * plugin.tx_solr.index.queue.<configurationName>.fields. | ||
| 539 | * | ||
| 540 | * @param string $configurationName | ||
| 541 | * @param array $defaultIfEmpty | ||
| 542 | * @return array | ||
| 543 | */ | ||
| 544 | 7 | public function getIndexQueueMappedFieldsByConfigurationName($configurationName = '', $defaultIfEmpty = []) | |
| 545 |     { | ||
| 546 | 7 | $mappingConfiguration = $this->getIndexQueueFieldsConfigurationByConfigurationName($configurationName); | |
| 547 | 7 | $mappedFieldNames = $this->getOnlyArrayKeysWhereValueIsNotAnArray($mappingConfiguration); | |
| 548 | 7 | return count($mappedFieldNames) == 0 ? $defaultIfEmpty : $mappedFieldNames; | |
| 549 | } | ||
| 550 | |||
| 551 | /** | ||
| 552 | * This method is used to check if an index queue configuration is enabled or not | ||
| 553 | * | ||
| 554 | * plugin.tx_solr.index.queue.<configurationName> = 1 | ||
| 555 | * | ||
| 556 | * @param string $configurationName | ||
| 557 | * @param bool $defaultIfEmpty | ||
| 558 | * @return bool | ||
| 559 | */ | ||
| 560 | 50 | public function getIndexQueueConfigurationIsEnabled($configurationName, $defaultIfEmpty = false) | |
| 561 |     { | ||
| 562 | 50 | $path = 'plugin.tx_solr.index.queue.' . $configurationName; | |
| 563 | 50 | $result = $this->getValueByPathOrDefaultValue($path, $defaultIfEmpty); | |
| 564 | 50 | return $this->getBool($result); | |
| 565 | } | ||
| 566 | |||
| 567 | /** | ||
| 568 | * Retrieves an array of enabled index queue configurations. | ||
| 569 | * | ||
| 570 | * plugin.tx_solr.index.queue.<configurationName> | ||
| 571 | * | ||
| 572 | * @param array $defaultIfEmpty | ||
| 573 | * @return array | ||
| 574 | */ | ||
| 575 | 57 | public function getEnabledIndexQueueConfigurationNames($defaultIfEmpty = []) | |
| 576 |     { | ||
| 577 | 57 | $tablesToIndex = []; | |
| 578 | 57 | $path = 'plugin.tx_solr.index.queue.'; | |
| 579 | 57 | $indexQueueConfiguration = $this->getObjectByPathOrDefault($path, []); | |
| 580 | 57 |         foreach ($indexQueueConfiguration as $configurationName => $indexingEnabled) { | |
| 581 | 55 |             if (substr($configurationName, -1) != '.' && $indexingEnabled) { | |
| 582 | 55 | $tablesToIndex[] = $configurationName; | |
| 583 | } | ||
| 584 | } | ||
| 585 | |||
| 586 | 57 | return count($tablesToIndex) == 0 ? $defaultIfEmpty : $tablesToIndex; | |
| 587 | } | ||
| 588 | |||
| 589 | /** | ||
| 590 | * Retrieves an array of additional fields that will trigger an recursive update of pages | ||
| 591 | * when some of the fields on that page are modified. | ||
| 592 | * | ||
| 593 | * plugin.tx_solr.index.queue.recursiveUpdateFields | ||
| 594 | * | ||
| 595 | * @param string $configurationName | ||
| 596 | * @param array $defaultIfEmpty | ||
| 597 | * @return array | ||
| 598 | */ | ||
| 599 | 23 | public function getIndexQueueConfigurationRecursiveUpdateFields($configurationName, $defaultIfEmpty = []) | |
| 600 |     { | ||
| 601 | 23 | $path = 'plugin.tx_solr.index.queue.' . $configurationName . '.recursiveUpdateFields'; | |
| 602 | 23 | $recursiveUpdateFieldsString = $this->getValueByPathOrDefaultValue($path, ''); | |
| 603 | 23 |         if (trim($recursiveUpdateFieldsString) === '') { | |
| 604 | 17 | return $defaultIfEmpty; | |
| 605 | } | ||
| 606 | 7 |         $recursiveUpdateFields = GeneralUtility::trimExplode(',', $recursiveUpdateFieldsString); | |
| 607 | // For easier check later on we return an array by combining $recursiveUpdateFields | ||
| 608 | 7 | return array_combine($recursiveUpdateFields, $recursiveUpdateFields); | |
| 609 | } | ||
| 610 | |||
| 611 | |||
| 612 | /** | ||
| 613 | * Retrieves and initialPagesAdditionalWhereClause where clause when configured or an empty string. | ||
| 614 | * | ||
| 615 | * plugin.tx_solr.index.queue.<configurationName>.initialPagesAdditionalWhereClause | ||
| 616 | * | ||
| 617 | * @param string $configurationName | ||
| 618 | * @return string | ||
| 619 | */ | ||
| 620 | 9 | public function getInitialPagesAdditionalWhereClause($configurationName) | |
| 621 |     { | ||
| 622 | 9 | $path = 'plugin.tx_solr.index.queue.' . $configurationName . '.initialPagesAdditionalWhereClause'; | |
| 623 | 9 | $initialPagesAdditionalWhereClause = $this->getValueByPathOrDefaultValue($path, ''); | |
| 624 | |||
| 625 | 9 |         if (trim($initialPagesAdditionalWhereClause) === '') { | |
| 626 | 9 | return ''; | |
| 627 | } | ||
| 628 | |||
| 629 | 1 | return ' AND ' . $initialPagesAdditionalWhereClause; | |
| 630 | } | ||
| 631 | |||
| 632 | /** | ||
| 633 | * Retrieves and additional where clause when configured or an empty string. | ||
| 634 | * | ||
| 635 | * plugin.tx_solr.index.queue.<configurationName>.additionalWhereClause | ||
| 636 | * | ||
| 637 | * @param string $configurationName | ||
| 638 | * @return string | ||
| 639 | */ | ||
| 640 | 53 | public function getIndexQueueAdditionalWhereClauseByConfigurationName($configurationName) | |
| 641 |     { | ||
| 642 | 53 | $path = 'plugin.tx_solr.index.queue.' . $configurationName . '.additionalWhereClause'; | |
| 643 | 53 | $additionalWhere = $this->getValueByPathOrDefaultValue($path, ''); | |
| 644 | |||
| 645 | 53 |         if (trim($additionalWhere) === '') { | |
| 646 | 14 | return ''; | |
| 647 | } | ||
| 648 | |||
| 649 | 40 | return ' AND ' . $additionalWhere; | |
| 650 | } | ||
| 651 | |||
| 652 | /** | ||
| 653 | * This method can be used to retrieve all index queue configuration names, where | ||
| 654 | * a certain table is used. It can be configured with the property "table" or is using the configuration | ||
| 655 | * key a fallback for the table name. | ||
| 656 | * | ||
| 657 | * plugin.tx_solr.index.queue.<configurationName>. | ||
| 658 | * | ||
| 659 | * @param string $tableName | ||
| 660 | * @param array $defaultIfEmpty | ||
| 661 | * @return array | ||
| 662 | */ | ||
| 663 | 1 | public function getIndexQueueConfigurationNamesByTableName($tableName, $defaultIfEmpty = []) | |
| 664 |     { | ||
| 665 | 1 | $path = 'plugin.tx_solr.index.queue.'; | |
| 666 | 1 | $configuration = $this->getObjectByPathOrDefault($path, []); | |
| 667 | 1 | $possibleConfigurations = []; | |
| 668 | |||
| 669 | 1 |         foreach ($configuration as $configurationName => $indexingEnabled) { | |
| 670 | 1 | $isObject = substr($configurationName, -1) == '.'; | |
| 671 | 1 |             if ($isObject || !$indexingEnabled) { | |
| 672 | 1 | continue; | |
| 673 | } | ||
| 674 | |||
| 675 | // when the configuration name equals the tableName we have a fallback | ||
| 676 | 1 | $hasTableNameAsConfigurationName = $configurationName == $tableName; | |
| 677 | 1 | $hasTableAssignedInQueueConfiguration = isset($configuration[$configurationName . '.']['table']) && | |
| 678 | 1 | $configuration[$configurationName . '.']['table'] == $tableName; | |
| 679 | 1 |             if ($hasTableNameAsConfigurationName || $hasTableAssignedInQueueConfiguration) { | |
| 680 | 1 | $possibleConfigurations[] = $configurationName; | |
| 681 | } | ||
| 682 | } | ||
| 683 | |||
| 684 | 1 | return count($possibleConfigurations) > 0 ? $possibleConfigurations : $defaultIfEmpty; | |
| 685 | } | ||
| 686 | |||
| 687 | /** | ||
| 688 | * This method is used to retrieve the className of a queue initializer for a certain indexing configuration | ||
| 689 | * of returns the default initializer class, when noting is configured. | ||
| 690 | * | ||
| 691 | * plugin.tx_solr.index.queue.<configurationName>.initialization | ||
| 692 | * | ||
| 693 | * @param string $configurationName | ||
| 694 | * @param string $defaultIfEmpty | ||
| 695 | * @return string | ||
| 696 | */ | ||
| 697 | 5 | public function getIndexQueueInitializerClassByConfigurationName($configurationName, $defaultIfEmpty = Record::class) | |
| 698 |     { | ||
| 699 | 5 | $path = 'plugin.tx_solr.index.queue.' . $configurationName . '.initialization'; | |
| 700 | 5 | $className = $this->getValueByPathOrDefaultValue($path, $defaultIfEmpty); | |
| 701 | |||
| 702 | 5 | return $className; | |
| 703 | } | ||
| 704 | |||
| 705 | /** | ||
| 706 | * Returns the configured javascript file for a specific fileKey. | ||
| 707 | * | ||
| 708 | * plugin.tx_solr.javascriptFiles.<fileKey> | ||
| 709 | * | ||
| 710 | * @param string $fileKey | ||
| 711 | * @param string $defaultIfEmpty | ||
| 712 | * @return string | ||
| 713 | */ | ||
| 714 | 26 | public function getJavaScriptFileByFileKey($fileKey, $defaultIfEmpty = '') | |
| 715 |     { | ||
| 716 | 26 |         $javaScriptFileName = $this->getValueByPathOrDefaultValue('plugin.tx_solr.javascriptFiles.' . $fileKey, $defaultIfEmpty); | |
| 717 | 26 | return (string)$javaScriptFileName; | |
| 718 | } | ||
| 719 | |||
| 720 | /** | ||
| 721 | * Returns the configuration where to load the javascript | ||
| 722 | * | ||
| 723 | * plugin.tx_solr.javascriptFiles.loadIn | ||
| 724 | * | ||
| 725 | * @param string $defaultIfEmpty | ||
| 726 | * @return string | ||
| 727 | */ | ||
| 728 | 25 | public function getJavaScriptLoadIn($defaultIfEmpty = 'footer') | |
| 729 |     { | ||
| 730 | 25 |         $loadIn = $this->getValueByPathOrDefaultValue('plugin.tx_solr.javascriptFiles.loadIn', $defaultIfEmpty); | |
| 731 | 25 | return (string)$loadIn; | |
| 732 | } | ||
| 733 | |||
| 734 | /** | ||
| 735 | * Returns the _LOCAL_LANG configuration from the TypoScript. | ||
| 736 | * | ||
| 737 | * plugin.tx_solr._LOCAL_LANG. | ||
| 738 | * | ||
| 739 | * @param array $defaultIfEmpty | ||
| 740 | * @return array | ||
| 741 | */ | ||
| 742 | 25 | public function getLocalLangConfiguration(array $defaultIfEmpty = []) | |
| 743 |     { | ||
| 744 | 25 |         $result = $this->getObjectByPathOrDefault('plugin.tx_solr._LOCAL_LANG.', $defaultIfEmpty); | |
| 745 | 25 | return $result; | |
| 746 | } | ||
| 747 | |||
| 748 | /** | ||
| 749 | * When this is enabled the output of the devlog, will be printed as debug output. | ||
| 750 | * | ||
| 751 | * @param bool $defaultIfEmpty | ||
| 752 | * @return bool | ||
| 753 | */ | ||
| 754 | public function getLoggingDebugOutput($defaultIfEmpty = false) | ||
| 755 |     { | ||
| 756 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.logging.debugOutput', $defaultIfEmpty); | ||
| 757 | return $this->getBool($result); | ||
| 758 | } | ||
| 759 | |||
| 760 | /** | ||
| 761 | * Returns if query filters should be written to the log. | ||
| 762 | * | ||
| 763 | * plugin.tx_solr.logging.query.filters | ||
| 764 | * | ||
| 765 | * @param bool $defaultIfEmpty | ||
| 766 | * @return bool | ||
| 767 | */ | ||
| 768 | 36 | public function getLoggingQueryFilters($defaultIfEmpty = false) | |
| 769 |     { | ||
| 770 | 36 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.logging.query.filters', $defaultIfEmpty); | |
| 771 | 36 | return $this->getBool($result); | |
| 772 | } | ||
| 773 | |||
| 774 | /** | ||
| 775 | * Returns if the querystring should be logged or not. | ||
| 776 | * | ||
| 777 | * plugin.tx_solr.logging.query.queryString | ||
| 778 | * | ||
| 779 | * @param bool $defaultIfEmpty | ||
| 780 | * @return bool | ||
| 781 | */ | ||
| 782 | 25 | public function getLoggingQueryQueryString($defaultIfEmpty = false) | |
| 783 |     { | ||
| 784 | 25 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.logging.query.queryString', $defaultIfEmpty); | |
| 785 | 25 | return $this->getBool($result); | |
| 786 | } | ||
| 787 | |||
| 788 | /** | ||
| 789 | * Returns if the searchWords should be logged or not. | ||
| 790 | * | ||
| 791 | * plugin.tx_solr.logging.query.searchWords | ||
| 792 | * | ||
| 793 | * @param bool $defaultIfEmpty | ||
| 794 | * @return bool | ||
| 795 | */ | ||
| 796 | 24 | public function getLoggingQuerySearchWords($defaultIfEmpty = false) | |
| 797 |     { | ||
| 798 | 24 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.logging.query.searchWords', $defaultIfEmpty); | |
| 799 | 24 | return $this->getBool($result); | |
| 800 | } | ||
| 801 | |||
| 802 | /** | ||
| 803 | * Returns if the rawGet requests should be logged or not. | ||
| 804 | * | ||
| 805 | * plugin.tx_solr.logging.query.rawGet | ||
| 806 | * | ||
| 807 | * @param bool $defaultIfEmpty | ||
| 808 | * @return bool | ||
| 809 | */ | ||
| 810 | 35 | public function getLoggingQueryRawGet($defaultIfEmpty = false) | |
| 811 |     { | ||
| 812 | 35 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.logging.query.rawGet', $defaultIfEmpty); | |
| 813 | 35 | return $this->getBool($result); | |
| 814 | } | ||
| 815 | |||
| 816 | /** | ||
| 817 | * Returns if the rawPost requests should be logged or not. | ||
| 818 | * | ||
| 819 | * plugin.tx_solr.logging.query.rawPost | ||
| 820 | * | ||
| 821 | * @param bool $defaultIfEmpty | ||
| 822 | * @return bool | ||
| 823 | */ | ||
| 824 | 59 | public function getLoggingQueryRawPost($defaultIfEmpty = false) | |
| 825 |     { | ||
| 826 | 59 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.logging.query.rawPost', $defaultIfEmpty); | |
| 827 | 59 | return $this->getBool($result); | |
| 828 | } | ||
| 829 | |||
| 830 | /** | ||
| 831 | * Returns if the rawDelete requests should be logged or not. | ||
| 832 | * | ||
| 833 | * plugin.tx_solr.logging.query.rawDelete | ||
| 834 | * | ||
| 835 | * @param bool $defaultIfEmpty | ||
| 836 | * @return bool | ||
| 837 | */ | ||
| 838 | 2 | public function getLoggingQueryRawDelete($defaultIfEmpty = false) | |
| 839 |     { | ||
| 840 | 2 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.logging.query.rawDelete', $defaultIfEmpty); | |
| 841 | 2 | return $this->getBool($result); | |
| 842 | } | ||
| 843 | |||
| 844 | /** | ||
| 845 | * Returns if exceptions should be logged or not. | ||
| 846 | * | ||
| 847 | * plugin.tx_solr.logging.exceptions | ||
| 848 | * | ||
| 849 | * @param bool $defaultIfEmpty | ||
| 850 | * @return bool | ||
| 851 | */ | ||
| 852 | 1 | public function getLoggingExceptions($defaultIfEmpty = true) | |
| 853 |     { | ||
| 854 | 1 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.logging.exceptions', $defaultIfEmpty); | |
| 855 | 1 | return $this->getBool($result); | |
| 856 | } | ||
| 857 | |||
| 858 | /** | ||
| 859 | * Returns if indexing operations should be logged or not. | ||
| 860 | * | ||
| 861 | * plugin.tx_solr.logging.indexing | ||
| 862 | * | ||
| 863 | * @param bool $defaultIfEmpty | ||
| 864 | * @return bool | ||
| 865 | */ | ||
| 866 | 14 | public function getLoggingIndexing($defaultIfEmpty = false) | |
| 867 |     { | ||
| 868 | 14 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.logging.indexing', $defaultIfEmpty); | |
| 869 | 14 | return $this->getBool($result); | |
| 870 | } | ||
| 871 | |||
| 872 | /** | ||
| 873 | * Returns if indexing queue operations should be logged or not. | ||
| 874 | * | ||
| 875 | * plugin.tx_solr.logging.indexing.queue | ||
| 876 | * | ||
| 877 | * @param bool $defaultIfEmpty | ||
| 878 | * @return bool | ||
| 879 | */ | ||
| 880 | 13 | public function getLoggingIndexingQueue($defaultIfEmpty = false) | |
| 881 |     { | ||
| 882 | 13 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.logging.indexing.queue', $defaultIfEmpty); | |
| 883 | 13 | return $this->getBool($result); | |
| 884 | } | ||
| 885 | |||
| 886 | /** | ||
| 887 | * This method can be used to check if the logging during indexing should be done. | ||
| 888 | * It takes the specific configuration by indexQueueConfiguration into account or is using the | ||
| 889 | * fallback when the logging is enabled on queue or indexing level. | ||
| 890 | * | ||
| 891 | * plugin.tx_solr.logging.indexing.queue.<indexQueueConfiguration> | ||
| 892 | * | ||
| 893 | * @param string $indexQueueConfiguration | ||
| 894 | * @param bool $defaultIfEmpty | ||
| 895 | * @return bool | ||
| 896 | */ | ||
| 897 | 14 | public function getLoggingIndexingQueueOperationsByConfigurationNameWithFallBack($indexQueueConfiguration, $defaultIfEmpty = false) | |
| 898 |     { | ||
| 899 | // when logging is globally enabled we do not need to check the specific configuration | ||
| 900 | 14 |         if ($this->getLoggingIndexing()) { | |
| 901 | 1 | return true; | |
| 902 | } | ||
| 903 | |||
| 904 | // when the logging for indexing is enabled on queue level we also do not need to check the specific configuration | ||
| 905 | 13 |         if ($this->getLoggingIndexingQueue()) { | |
| 906 | return true; | ||
| 907 | } | ||
| 908 | |||
| 909 | 13 | $path = 'plugin.tx_solr.logging.indexing.queue.' . $indexQueueConfiguration; | |
| 910 | 13 | $result = $this->getValueByPathOrDefaultValue($path, $defaultIfEmpty); | |
| 911 | 13 | return $this->getBool($result); | |
| 912 | } | ||
| 913 | |||
| 914 | /** | ||
| 915 | * Returns if a log message should be written when a page was indexed. | ||
| 916 | * | ||
| 917 | * plugin.tx_solr.logging.indexing.pageIndexed | ||
| 918 | * | ||
| 919 | * @param bool $defaultIfEmpty | ||
| 920 | * @return bool | ||
| 921 | */ | ||
| 922 | 6 | public function getLoggingIndexingPageIndexed($defaultIfEmpty = false) | |
| 923 |     { | ||
| 924 | 6 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.logging.indexing.pageIndexed', $defaultIfEmpty); | |
| 925 | 6 | return $this->getBool($result); | |
| 926 | } | ||
| 927 | |||
| 928 | /** | ||
| 929 | * Returns if a log message should be written when the TYPO3 search markers are missing in the page. | ||
| 930 | * | ||
| 931 | * plugin.tx_solr.logging.indexing.missingTypo3SearchMarkers | ||
| 932 | * | ||
| 933 | * @param bool $defaultIfEmpty | ||
| 934 | * @return bool | ||
| 935 | */ | ||
| 936 | 7 | public function getLoggingIndexingMissingTypo3SearchMarkers($defaultIfEmpty = true) | |
| 937 |     { | ||
| 938 | 7 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.logging.indexing.missingTypo3SearchMarkers', $defaultIfEmpty); | |
| 939 | 7 | return $this->getBool($result); | |
| 940 | } | ||
| 941 | |||
| 942 | /** | ||
| 943 | * Returns if the initialization of an indexqueue should be logged. | ||
| 944 | * | ||
| 945 | * plugin.tx_solr.logging.indexing.indexQueueInitialization | ||
| 946 | * | ||
| 947 | * @param bool $defaultIfEmpty | ||
| 948 | * @return bool | ||
| 949 | */ | ||
| 950 | 7 | public function getLoggingIndexingIndexQueueInitialization($defaultIfEmpty = false) | |
| 951 |     { | ||
| 952 | 7 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.logging.indexing.indexQueueInitialization', $defaultIfEmpty); | |
| 953 | 7 | return $this->getBool($result); | |
| 954 | } | ||
| 955 | |||
| 956 | /** | ||
| 957 | * Indicates if the debug mode is enabled or not. | ||
| 958 | * | ||
| 959 | * plugin.tx_solr.enableDebugMode | ||
| 960 | * | ||
| 961 | * @param bool $defaultIfEmpty | ||
| 962 | * @return bool | ||
| 963 | */ | ||
| 964 | 24 | public function getEnabledDebugMode($defaultIfEmpty = false) | |
| 965 |     { | ||
| 966 | 24 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.enableDebugMode', $defaultIfEmpty); | |
| 967 | 24 | return $this->getBool($result); | |
| 968 | } | ||
| 969 | |||
| 970 | /** | ||
| 971 | * Returns true or false if something is configured below plugin.tx_solr.solr. | ||
| 972 | * | ||
| 973 | * plugin.tx_solr.solr. | ||
| 974 | * | ||
| 975 | * @param boolean $defaultIfEmpty | ||
| 976 | * @return boolean | ||
| 977 | */ | ||
| 978 | 3 | public function getSolrHasConnectionConfiguration($defaultIfEmpty = false) | |
| 979 |     { | ||
| 980 | 3 |         $configuration = $this->getObjectByPathOrDefault('plugin.tx_solr.solr.', []); | |
| 981 | 3 | return $configuration !== [] ? true : $defaultIfEmpty; | |
| 982 | } | ||
| 983 | |||
| 984 | /** | ||
| 985 | * Returns the defaultTimeout used for requests to the Solr server | ||
| 986 | * | ||
| 987 | * plugin.tx_solr.solr.timeout | ||
| 988 | * | ||
| 989 | * @param float $defaultIfEmpty | ||
| 990 | * @return float | ||
| 991 | */ | ||
| 992 | 76 | public function getSolrTimeout($defaultIfEmpty = 0.0) | |
| 993 |     { | ||
| 994 | 76 |         return (float)$this->getValueByPathOrDefaultValue('plugin.tx_solr.solr.timeout', $defaultIfEmpty); | |
| 995 | } | ||
| 996 | |||
| 997 | /** | ||
| 998 | * Returns the scheme used for requests to the Solr server | ||
| 999 | * | ||
| 1000 | * plugin.tx_solr.solr.scheme | ||
| 1001 | * | ||
| 1002 | * Applies stdWrap on the configured setting | ||
| 1003 | * | ||
| 1004 | * @param string $defaultIfEmpty | ||
| 1005 | * @return string | ||
| 1006 | */ | ||
| 1007 | 4 | public function getSolrScheme($defaultIfEmpty = 'http') | |
| 1008 |     { | ||
| 1009 | 4 | $valuePath = 'plugin.tx_solr.solr.scheme'; | |
| 1010 | 4 | $value = (string)$this->getValueByPathOrDefaultValue($valuePath, $defaultIfEmpty); | |
| 1011 | 4 | return $this->renderContentElementOfConfigured($valuePath, $value); | |
| 1012 | } | ||
| 1013 | |||
| 1014 | /** | ||
| 1015 | * Returns the hostname used for requests to the Solr server | ||
| 1016 | * | ||
| 1017 | * plugin.tx_solr.solr.host | ||
| 1018 | * | ||
| 1019 | * Applies stdWrap on the configured setting | ||
| 1020 | * | ||
| 1021 | * @param string $defaultIfEmpty | ||
| 1022 | * @return string | ||
| 1023 | */ | ||
| 1024 | 7 | public function getSolrHost($defaultIfEmpty = 'localhost') | |
| 1025 |     { | ||
| 1026 | 7 | $valuePath = 'plugin.tx_solr.solr.host'; | |
| 1027 | 7 | $value = (string)$this->getValueByPathOrDefaultValue($valuePath, $defaultIfEmpty); | |
| 1028 | 7 | return $this->renderContentElementOfConfigured($valuePath, $value); | |
| 1029 | } | ||
| 1030 | |||
| 1031 | /** | ||
| 1032 | * Returns the port used for requests to the Solr server | ||
| 1033 | * | ||
| 1034 | * plugin.tx_solr.solr.port | ||
| 1035 | * | ||
| 1036 | * Applies stdWrap on the configured setting | ||
| 1037 | * | ||
| 1038 | * @param int $defaultIfEmpty | ||
| 1039 | * @return int | ||
| 1040 | */ | ||
| 1041 | 4 | public function getSolrPort($defaultIfEmpty = 8983) | |
| 1042 |     { | ||
| 1043 | 4 | $valuePath = 'plugin.tx_solr.solr.port'; | |
| 1044 | 4 | $value = (string)$this->getValueByPathOrDefaultValue($valuePath, $defaultIfEmpty); | |
| 1045 | 4 | return $this->renderContentElementOfConfigured($valuePath, $value); | |
| 1046 | } | ||
| 1047 | |||
| 1048 | /** | ||
| 1049 | * Returns the path used for requests to the Solr server | ||
| 1050 | * | ||
| 1051 | * plugin.tx_solr.solr.path | ||
| 1052 | * | ||
| 1053 | * Applies stdWrap on the configured setting | ||
| 1054 | * | ||
| 1055 | * @param string $defaultIfEmpty | ||
| 1056 | * @return string | ||
| 1057 | */ | ||
| 1058 | 7 | public function getSolrPath($defaultIfEmpty = '/solr/core_en/') | |
| 1059 |     { | ||
| 1060 | 7 | $valuePath = 'plugin.tx_solr.solr.path'; | |
| 1061 | 7 | $value = (string)$this->getValueByPathOrDefaultValue($valuePath, $defaultIfEmpty); | |
| 1062 | 7 | $solrPath = $this->renderContentElementOfConfigured($valuePath, $value); | |
| 1063 | |||
| 1064 | 7 | $solrPath = trim($solrPath, '/'); | |
| 1065 | 7 | $solrPath = '/' . $solrPath . '/'; | |
| 1066 | |||
| 1067 | 7 | return $solrPath; | |
| 1068 | } | ||
| 1069 | |||
| 1070 | /** | ||
| 1071 | * Returns the username used for requests to the Solr server | ||
| 1072 | * | ||
| 1073 | * plugin.tx_solr.solr.username | ||
| 1074 | * | ||
| 1075 | * Applies stdWrap on the configured setting | ||
| 1076 | * | ||
| 1077 | * @param string $defaultIfEmpty | ||
| 1078 | * @return string | ||
| 1079 | */ | ||
| 1080 | 4 | public function getSolrUsername($defaultIfEmpty = '') | |
| 1081 |     { | ||
| 1082 | 4 | $valuePath = 'plugin.tx_solr.solr.username'; | |
| 1083 | 4 | $value = (string)$this->getValueByPathOrDefaultValue($valuePath, $defaultIfEmpty); | |
| 1084 | 4 | return $this->renderContentElementOfConfigured($valuePath, $value); | |
| 1085 | } | ||
| 1086 | |||
| 1087 | /** | ||
| 1088 | * Returns the password used for requests to the Solr server | ||
| 1089 | * | ||
| 1090 | * plugin.tx_solr.solr.password | ||
| 1091 | * | ||
| 1092 | * Applies stdWrap on the configured setting | ||
| 1093 | * | ||
| 1094 | * @param string $defaultIfEmpty | ||
| 1095 | * @return string | ||
| 1096 | */ | ||
| 1097 | 4 | public function getSolrPassword($defaultIfEmpty = '') | |
| 1098 |     { | ||
| 1099 | 4 | $valuePath = 'plugin.tx_solr.solr.password'; | |
| 1100 | 4 | $value = (string)$this->getValueByPathOrDefaultValue($valuePath, $defaultIfEmpty); | |
| 1101 | 4 | return $this->renderContentElementOfConfigured($valuePath, $value); | |
| 1102 | } | ||
| 1103 | |||
| 1104 | /** | ||
| 1105 | * Retrieves the complete search configuration | ||
| 1106 | * | ||
| 1107 | * plugin.tx_solr.search. | ||
| 1108 | * | ||
| 1109 | * @param array $defaultIfEmpty | ||
| 1110 | * @return array | ||
| 1111 | */ | ||
| 1112 | 24 | public function getSearchConfiguration(array $defaultIfEmpty = []) | |
| 1113 |     { | ||
| 1114 | 24 |         $result = $this->getObjectByPathOrDefault('plugin.tx_solr.search.', $defaultIfEmpty); | |
| 1115 | 24 | return $result; | |
| 1116 | } | ||
| 1117 | |||
| 1118 | /** | ||
| 1119 | * Indicates if elevation should be used or not | ||
| 1120 | * | ||
| 1121 | * plugin.tx_solr.search.elevation | ||
| 1122 | * | ||
| 1123 | * @param bool $defaultIfEmpty | ||
| 1124 | * @return bool | ||
| 1125 | */ | ||
| 1126 | 24 | public function getSearchElevation($defaultIfEmpty = false) | |
| 1127 |     { | ||
| 1128 | 24 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.elevation', $defaultIfEmpty); | |
| 1129 | 24 | return $this->getBool($result); | |
| 1130 | } | ||
| 1131 | |||
| 1132 | /** | ||
| 1133 | * Indicates if elevated results should be marked | ||
| 1134 | * | ||
| 1135 | * plugin.tx_solr.search.elevation.markElevatedResults | ||
| 1136 | * | ||
| 1137 | * @param bool $defaultIfEmpty | ||
| 1138 | * @return bool | ||
| 1139 | */ | ||
| 1140 | 24 | public function getSearchElevationMarkElevatedResults($defaultIfEmpty = true) | |
| 1141 |     { | ||
| 1142 | 24 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.elevation.markElevatedResults', $defaultIfEmpty); | |
| 1143 | 24 | return $this->getBool($result); | |
| 1144 | } | ||
| 1145 | |||
| 1146 | /** | ||
| 1147 | * Indicates if elevation should be forced | ||
| 1148 | * | ||
| 1149 | *plugin.tx_solr.search.elevation.forceElevation | ||
| 1150 | * | ||
| 1151 | * @param bool $defaultIfEmpty | ||
| 1152 | * @return bool | ||
| 1153 | */ | ||
| 1154 | 24 | public function getSearchElevationForceElevation($defaultIfEmpty = true) | |
| 1155 |     { | ||
| 1156 | 24 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.elevation.forceElevation', $defaultIfEmpty); | |
| 1157 | 24 | return $this->getBool($result); | |
| 1158 | } | ||
| 1159 | |||
| 1160 | /** | ||
| 1161 | * Indicates if collapsing on a certain field should be used to build variants or not. | ||
| 1162 | * | ||
| 1163 | * plugin.tx_solr.search.variants | ||
| 1164 | * | ||
| 1165 | * @param bool $defaultIfEmpty | ||
| 1166 | * @return bool | ||
| 1167 | */ | ||
| 1168 | 129 | public function getSearchVariants($defaultIfEmpty = false) | |
| 1169 |     { | ||
| 1170 | 129 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.variants', $defaultIfEmpty); | |
| 1171 | 129 | return $this->getBool($result); | |
| 1172 | } | ||
| 1173 | |||
| 1174 | /** | ||
| 1175 | * Indicates if collapsing on a certain field should be used or not | ||
| 1176 | * | ||
| 1177 | * plugin.tx_solr.search.variants.variantField | ||
| 1178 | * | ||
| 1179 | * @param string $defaultIfEmpty | ||
| 1180 | * @return string | ||
| 1181 | */ | ||
| 1182 | 3 | public function getSearchVariantsField($defaultIfEmpty = 'variantId') | |
| 1183 |     { | ||
| 1184 | 3 |         return $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.variants.variantField', $defaultIfEmpty); | |
| 1185 | } | ||
| 1186 | |||
| 1187 | /** | ||
| 1188 | * Indicates if expanding of collapsed items it activated. | ||
| 1189 | * | ||
| 1190 | * plugin.tx_solr.search.variants.expand | ||
| 1191 | * | ||
| 1192 | * @param bool $defaultIfEmpty | ||
| 1193 | * @return bool | ||
| 1194 | */ | ||
| 1195 | 4 | public function getSearchVariantsExpand($defaultIfEmpty = false) | |
| 1196 |     { | ||
| 1197 | 4 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.variants.expand', $defaultIfEmpty); | |
| 1198 | 4 | return $this->getBool($result); | |
| 1199 | } | ||
| 1200 | |||
| 1201 | /** | ||
| 1202 | * Retrieves the number of elements that should be expanded. | ||
| 1203 | * | ||
| 1204 | * plugin.tx_solr.search.variants.limit | ||
| 1205 | * | ||
| 1206 | * @param int $defaultIfEmpty | ||
| 1207 | * @return int | ||
| 1208 | */ | ||
| 1209 | 2 | public function getSearchVariantsLimit($defaultIfEmpty = 10) | |
| 1210 |     { | ||
| 1211 | 2 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.variants.limit', $defaultIfEmpty); | |
| 1212 | 2 | return (int)$result; | |
| 1213 | } | ||
| 1214 | |||
| 1215 | /** | ||
| 1216 | * Indicates if frequent searches should be show or not. | ||
| 1217 | * | ||
| 1218 | * plugin.tx_solr.search.frequentSearches | ||
| 1219 | * | ||
| 1220 | * @param bool $defaultIfEmpty | ||
| 1221 | * @return bool | ||
| 1222 | */ | ||
| 1223 | 23 | public function getSearchFrequentSearches($defaultIfEmpty = false) | |
| 1224 |     { | ||
| 1225 | 23 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.frequentSearches', $defaultIfEmpty); | |
| 1226 | 23 | return $this->getBool($result); | |
| 1227 | } | ||
| 1228 | |||
| 1229 | /** | ||
| 1230 | * Returns the sub configuration of the frequentSearches | ||
| 1231 | * | ||
| 1232 | * plugin.tx_solr.search.frequentSearches. | ||
| 1233 | * | ||
| 1234 | * @param array $defaultIfEmpty | ||
| 1235 | * @return array | ||
| 1236 | */ | ||
| 1237 | 23 | public function getSearchFrequentSearchesConfiguration($defaultIfEmpty = []) | |
| 1238 |     { | ||
| 1239 | 23 |         $result = $this->getObjectByPathOrDefault('plugin.tx_solr.search.frequentSearches.', $defaultIfEmpty); | |
| 1240 | 23 | return $result; | |
| 1241 | } | ||
| 1242 | |||
| 1243 | /** | ||
| 1244 | * Retrieves the minimum font size that should be used for the frequentSearches. | ||
| 1245 | * | ||
| 1246 | * plugin.tx_solr.search.frequentSearches.minSize | ||
| 1247 | * | ||
| 1248 | * @param int $defaultIfEmpty | ||
| 1249 | * @return int | ||
| 1250 | */ | ||
| 1251 | public function getSearchFrequentSearchesMinSize($defaultIfEmpty = 14) | ||
| 1252 |     { | ||
| 1253 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.frequentSearches.minSize', $defaultIfEmpty); | ||
| 1254 | return (int)$result; | ||
| 1255 | } | ||
| 1256 | |||
| 1257 | /** | ||
| 1258 | * Retrieves the maximum font size that should be used for the frequentSearches. | ||
| 1259 | * | ||
| 1260 | * plugin.tx_solr.search.frequentSearches.minSize | ||
| 1261 | * | ||
| 1262 | * @param int $defaultIfEmpty | ||
| 1263 | * @return int | ||
| 1264 | */ | ||
| 1265 | public function getSearchFrequentSearchesMaxSize($defaultIfEmpty = 32) | ||
| 1266 |     { | ||
| 1267 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.frequentSearches.maxSize', $defaultIfEmpty); | ||
| 1268 | return (int)$result; | ||
| 1269 | } | ||
| 1270 | |||
| 1271 | /** | ||
| 1272 | * Indicates if frequent searches should be show or not. | ||
| 1273 | * | ||
| 1274 | * plugin.tx_solr.search.frequentSearches.useLowercaseKeywords | ||
| 1275 | * | ||
| 1276 | * @param bool $defaultIfEmpty | ||
| 1277 | * @return bool | ||
| 1278 | */ | ||
| 1279 | 18 | public function getSearchFrequentSearchesUseLowercaseKeywords($defaultIfEmpty = false) | |
| 1280 |     { | ||
| 1281 | 18 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.frequentSearches.useLowercaseKeywords', $defaultIfEmpty); | |
| 1282 | 18 | return $this->getBool($result); | |
| 1283 | } | ||
| 1284 | |||
| 1285 | /** | ||
| 1286 | * Returns the configuration if the search should be initialized with an empty query. | ||
| 1287 | * | ||
| 1288 | * plugin.tx_solr.search.initializeWithEmptyQuery | ||
| 1289 | * | ||
| 1290 | * @param bool $defaultIfEmpty | ||
| 1291 | * @return bool | ||
| 1292 | */ | ||
| 1293 | 26 | public function getSearchInitializeWithEmptyQuery($defaultIfEmpty = false) | |
| 1294 |     { | ||
| 1295 | 26 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.initializeWithEmptyQuery', $defaultIfEmpty); | |
| 1296 | 26 | return $this->getBool($result); | |
| 1297 | } | ||
| 1298 | |||
| 1299 | /** | ||
| 1300 | * Returns the configured initial query | ||
| 1301 | * | ||
| 1302 | * plugin.tx_solr.search.initializeWithQuery | ||
| 1303 | * | ||
| 1304 | * @param string $defaultIfEmpty | ||
| 1305 | * @return string | ||
| 1306 | */ | ||
| 1307 | 26 | public function getSearchInitializeWithQuery($defaultIfEmpty = '') | |
| 1308 |     { | ||
| 1309 | 26 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.initializeWithQuery', $defaultIfEmpty); | |
| 1310 | 26 | return (string)$result; | |
| 1311 | } | ||
| 1312 | |||
| 1313 | /** | ||
| 1314 | * Returns if the last searches should be displayed or not. | ||
| 1315 | * | ||
| 1316 | * plugin.tx_solr.search.lastSearches | ||
| 1317 | * | ||
| 1318 | * @param bool $defaultIfEmpty | ||
| 1319 | * @return bool | ||
| 1320 | */ | ||
| 1321 | 23 | public function getSearchLastSearches($defaultIfEmpty = false) | |
| 1322 |     { | ||
| 1323 | 23 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.lastSearches', $defaultIfEmpty); | |
| 1324 | 23 | return $this->getBool($result); | |
| 1325 | } | ||
| 1326 | |||
| 1327 | /** | ||
| 1328 | * Returns the lastSearch mode. "user" for user specific | ||
| 1329 | * | ||
| 1330 | * plugin.tx_solr.search.lastSearches.mode | ||
| 1331 | * | ||
| 1332 | * @param string $defaultIfEmpty | ||
| 1333 | * @return string | ||
| 1334 | */ | ||
| 1335 | 23 | public function getSearchLastSearchesMode($defaultIfEmpty = 'user') | |
| 1336 |     { | ||
| 1337 | 23 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.lastSearches.mode', $defaultIfEmpty); | |
| 1338 | 23 | return (string)$result; | |
| 1339 | } | ||
| 1340 | |||
| 1341 | /** | ||
| 1342 | * Returns the lastSearch limit | ||
| 1343 | * | ||
| 1344 | * plugin.tx_solr.search.lastSearches.limit | ||
| 1345 | * | ||
| 1346 | * @param int $defaultIfEmpty | ||
| 1347 | * @return int | ||
| 1348 | */ | ||
| 1349 | 23 | public function getSearchLastSearchesLimit($defaultIfEmpty = 10) | |
| 1350 |     { | ||
| 1351 | 23 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.lastSearches.limit', $defaultIfEmpty); | |
| 1352 | 23 | return (int)$result; | |
| 1353 | } | ||
| 1354 | |||
| 1355 | /** | ||
| 1356 | * Returns the search results fieldProcessingInstructions configuration array | ||
| 1357 | * | ||
| 1358 | * plugin.tx_solr.search.results.fieldProcessingInstructions. | ||
| 1359 | * | ||
| 1360 | * @param array $defaultIfEmpty | ||
| 1361 | * @return array | ||
| 1362 | */ | ||
| 1363 | 18 | public function getSearchResultsFieldProcessingInstructionsConfiguration(array $defaultIfEmpty = []) | |
| 1364 |     { | ||
| 1365 | 18 |         $result = $this->getObjectByPathOrDefault('plugin.tx_solr.search.results.fieldProcessingInstructions.', $defaultIfEmpty); | |
| 1366 | 18 | return $result; | |
| 1367 | } | ||
| 1368 | |||
| 1369 | /** | ||
| 1370 | * Returns the search results fieldRenderingInstructions configuration array | ||
| 1371 | * | ||
| 1372 | * plugin.tx_solr.search.results.fieldRenderingInstructions. | ||
| 1373 | * | ||
| 1374 | * @param array $defaultIfEmpty | ||
| 1375 | * @return array | ||
| 1376 | */ | ||
| 1377 | 18 | public function getSearchResultsFieldRenderingInstructionsConfiguration(array $defaultIfEmpty = []) | |
| 1378 |     { | ||
| 1379 | 18 |         $result = $this->getObjectByPathOrDefault('plugin.tx_solr.search.results.fieldRenderingInstructions.', $defaultIfEmpty); | |
| 1380 | 18 | return $result; | |
| 1381 | } | ||
| 1382 | |||
| 1383 | /** | ||
| 1384 | * Indicates if the results of an initial empty query should be shown or not. | ||
| 1385 | * | ||
| 1386 | * plugin.tx_solr.search.showResultsOfInitialEmptyQuery | ||
| 1387 | * | ||
| 1388 | * @param bool $defaultIfEmpty | ||
| 1389 | * @return bool | ||
| 1390 | */ | ||
| 1391 | 4 | public function getSearchShowResultsOfInitialEmptyQuery($defaultIfEmpty = false) | |
| 1392 |     { | ||
| 1393 | 4 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.showResultsOfInitialEmptyQuery', $defaultIfEmpty); | |
| 1394 | 4 | return $this->getBool($result); | |
| 1395 | } | ||
| 1396 | |||
| 1397 | /** | ||
| 1398 | * Indicates if the results of an initial search query should be shown. | ||
| 1399 | * | ||
| 1400 | * plugin.tx_solr.search.showResultsOfInitialQuery | ||
| 1401 | * | ||
| 1402 | * @param bool $defaultIfEmpty | ||
| 1403 | * @return bool | ||
| 1404 | */ | ||
| 1405 | 4 | public function getSearchShowResultsOfInitialQuery($defaultIfEmpty = false) | |
| 1406 |     { | ||
| 1407 | 4 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.showResultsOfInitialQuery', $defaultIfEmpty); | |
| 1408 | 4 | return $this->getBool($result); | |
| 1409 | } | ||
| 1410 | |||
| 1411 | /** | ||
| 1412 | * Indicates if sorting was enabled or not. | ||
| 1413 | * | ||
| 1414 | * plugin.tx_solr.search.sorting | ||
| 1415 | * | ||
| 1416 | * @param bool $defaultIfEmpty | ||
| 1417 | * @return bool | ||
| 1418 | */ | ||
| 1419 | 17 | public function getSearchSorting($defaultIfEmpty = false) | |
| 1420 |     { | ||
| 1421 | 17 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.sorting', $defaultIfEmpty); | |
| 1422 | 17 | return $this->getBool($result); | |
| 1423 | } | ||
| 1424 | |||
| 1425 | /** | ||
| 1426 | * Returns the sorting options configurations. | ||
| 1427 | * | ||
| 1428 | * plugin.tx_solr.search.sorting.options. | ||
| 1429 | * | ||
| 1430 | * @param array $defaultIfEmpty | ||
| 1431 | * @return array | ||
| 1432 | */ | ||
| 1433 | 17 | public function getSearchSortingOptionsConfiguration($defaultIfEmpty = []) | |
| 1434 |     { | ||
| 1435 | 17 |         $result = $this->getObjectByPathOrDefault('plugin.tx_solr.search.sorting.options.', $defaultIfEmpty); | |
| 1436 | 17 | return $result; | |
| 1437 | } | ||
| 1438 | |||
| 1439 | /** | ||
| 1440 | * Retrieves the sorting default order for a sort option. | ||
| 1441 | * | ||
| 1442 | * plugin.tx_solr.search.sorting.options.<sortOptionName>.defaultOrder | ||
| 1443 | * | ||
| 1444 | * or | ||
| 1445 | * | ||
| 1446 | * plugin.tx_solr.search.sorting.defaultOrder | ||
| 1447 | * | ||
| 1448 | * | ||
| 1449 | * @param string $sortOptionName | ||
| 1450 | * @param string $defaultIfEmpty | ||
| 1451 | * @return string | ||
| 1452 | */ | ||
| 1453 | 17 | public function getSearchSortingDefaultOrderBySortOptionName($sortOptionName = '', $defaultIfEmpty = 'asc') | |
| 1454 |     { | ||
| 1455 | 17 | $sortOrderSpecificPath = 'plugin.tx_solr.search.sorting.options.' . $sortOptionName . '.defaultOrder'; | |
| 1456 | 17 | $specificSortOrder = $this->getValueByPathOrDefaultValue($sortOrderSpecificPath, null); | |
| 1457 | |||
| 1458 | // if we have a concrete setting, use it | ||
| 1459 | 17 |         if ($specificSortOrder !== null) { | |
| 1460 | return $specificSortOrder; | ||
| 1461 | } | ||
| 1462 | |||
| 1463 | // no specific setting, check common setting | ||
| 1464 | 17 | $commonPath = 'plugin.tx_solr.search.sorting.defaultOrder'; | |
| 1465 | 17 | $commonATagParamOrDefaultValue = $this->getValueByPathOrDefaultValue($commonPath, $defaultIfEmpty); | |
| 1466 | 17 | return $commonATagParamOrDefaultValue; | |
| 1467 | } | ||
| 1468 | |||
| 1469 | /** | ||
| 1470 | * Returns the configured fixedOrder, if nothing configured defaultIfEmpty will be returned. | ||
| 1471 | * | ||
| 1472 | * plugin.tx_solr.search.sorting.options.<sortOptionName>.fixedOrder | ||
| 1473 | * | ||
| 1474 | * @param string $sortOptionName | ||
| 1475 | * @param string $defaultIfEmpty | ||
| 1476 | * @return string | ||
| 1477 | */ | ||
| 1478 | 17 | public function getSearchSortingFixedOrderBySortOptionName($sortOptionName = '', $defaultIfEmpty = '') | |
| 1479 |     { | ||
| 1480 | 17 | $fixedOrder = 'plugin.tx_solr.search.sorting.options.' . $sortOptionName . '.fixedOrder'; | |
| 1481 | 17 | return $this->getValueByPathOrDefaultValue($fixedOrder, $defaultIfEmpty); | |
| 1482 | } | ||
| 1483 | |||
| 1484 | /** | ||
| 1485 | * Returns the trusted fields configured for the search that do not need to be escaped. | ||
| 1486 | * | ||
| 1487 | * @param array $defaultIfEmpty | ||
| 1488 | * @return array | ||
| 1489 | */ | ||
| 1490 | 18 | public function getSearchTrustedFieldsArray($defaultIfEmpty = ['url']) | |
| 1491 |     { | ||
| 1492 | 18 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.trustedFields', ''); | |
| 1493 | |||
| 1494 | 18 |         if (trim($result) === '') { | |
| 1495 | return $defaultIfEmpty; | ||
| 1496 | } | ||
| 1497 | |||
| 1498 | 18 |         return GeneralUtility::trimExplode(',', $result); | |
| 1499 | } | ||
| 1500 | |||
| 1501 | /** | ||
| 1502 | * Indicates if the plugin arguments should be kept in the search form for a second submission. | ||
| 1503 | * | ||
| 1504 | * plugin.tx_solr.search.keepExistingParametersForNewSearches | ||
| 1505 | * | ||
| 1506 | * @param bool $defaultIfEmpty | ||
| 1507 | * @return bool | ||
| 1508 | */ | ||
| 1509 | 23 | public function getSearchKeepExistingParametersForNewSearches($defaultIfEmpty = false) | |
| 1510 |     { | ||
| 1511 | 23 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.keepExistingParametersForNewSearches', $defaultIfEmpty); | |
| 1512 | 23 | return $this->getBool($result); | |
| 1513 | } | ||
| 1514 | |||
| 1515 | /** | ||
| 1516 | * Returns if an empty query is allowed on the query level. | ||
| 1517 | * | ||
| 1518 | * plugin.tx_solr.search.query.allowEmptyQuery | ||
| 1519 | * | ||
| 1520 | * @param string $defaultIfEmpty | ||
| 1521 | * @return bool | ||
| 1522 | */ | ||
| 1523 | 26 | public function getSearchQueryAllowEmptyQuery($defaultIfEmpty = '') | |
| 1524 |     { | ||
| 1525 | 26 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.query.allowEmptyQuery', $defaultIfEmpty); | |
| 1526 | 26 | return $this->getBool($result); | |
| 1527 | } | ||
| 1528 | |||
| 1529 | /** | ||
| 1530 | * Returns the fieldProcessingInstructions configuration array | ||
| 1531 | * | ||
| 1532 | * plugin.tx_solr.search.query.filter. | ||
| 1533 | * | ||
| 1534 | * @param array $defaultIfEmpty | ||
| 1535 | * @return array | ||
| 1536 | */ | ||
| 1537 | 32 | public function getSearchQueryFilterConfiguration(array $defaultIfEmpty = []) | |
| 1538 |     { | ||
| 1539 | 32 |         $result = $this->getObjectByPathOrDefault('plugin.tx_solr.search.query.filter.', $defaultIfEmpty); | |
| 1540 | 32 | return $result; | |
| 1541 | } | ||
| 1542 | |||
| 1543 | /** | ||
| 1544 | * Can be used to overwrite the filterConfiguration. | ||
| 1545 | * | ||
| 1546 | * plugin.tx_solr.search.query.filter. | ||
| 1547 | * | ||
| 1548 | * @param array $configuration | ||
| 1549 | */ | ||
| 1550 | 1 | public function setSearchQueryFilterConfiguration(array $configuration) | |
| 1551 |     { | ||
| 1552 | 1 |         $this->configurationAccess->set('plugin.tx_solr.search.query.filter.', $configuration); | |
| 1553 | 1 | } | |
| 1554 | |||
| 1555 | /** | ||
| 1556 | * Removes the pageSections filter setting. | ||
| 1557 | * | ||
| 1558 | * @return void | ||
| 1559 | */ | ||
| 1560 | 2 | public function removeSearchQueryFilterForPageSections() | |
| 1561 |     { | ||
| 1562 | 2 |         $this->configurationAccess->reset('plugin.tx_solr.search.query.filter.__pageSections'); | |
| 1563 | 2 | } | |
| 1564 | |||
| 1565 | /** | ||
| 1566 | * Returns the configured queryFields from TypoScript | ||
| 1567 | * | ||
| 1568 | * plugin.tx_solr.search.query.queryFields | ||
| 1569 | * | ||
| 1570 | * @param string $defaultIfEmpty | ||
| 1571 | * @return string | ||
| 1572 | */ | ||
| 1573 | 130 | public function getSearchQueryQueryFields($defaultIfEmpty = '') | |
| 1574 |     { | ||
| 1575 | 130 |         return $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.query.queryFields', $defaultIfEmpty); | |
| 1576 | } | ||
| 1577 | |||
| 1578 | /** | ||
| 1579 | * Returns the configured returnFields as array. | ||
| 1580 | * | ||
| 1581 | * plugin.tx_solr.search.query.returnFields | ||
| 1582 | * | ||
| 1583 | * @param array $defaultIfEmpty | ||
| 1584 | * @return array | ||
| 1585 | */ | ||
| 1586 | 132 | public function getSearchQueryReturnFieldsAsArray($defaultIfEmpty = []) | |
| 1587 |     { | ||
| 1588 | 132 |         $returnFields = $this->getValueByPath('plugin.tx_solr.search.query.returnFields'); | |
| 1589 | 132 |         if (is_null($returnFields)) { | |
| 1590 | 105 | return $defaultIfEmpty; | |
| 1591 | } | ||
| 1592 | |||
| 1593 | 27 |         return GeneralUtility::trimExplode(',', $returnFields); | |
| 1594 | } | ||
| 1595 | |||
| 1596 | /** | ||
| 1597 | * Returns the configured target page for the search. | ||
| 1598 | * By default the contextPageId will be used | ||
| 1599 | * | ||
| 1600 | * plugin.tx_solr.search.targetPage | ||
| 1601 | * | ||
| 1602 | * @return int | ||
| 1603 | */ | ||
| 1604 | 135 | public function getSearchTargetPage() | |
| 1605 |     { | ||
| 1606 | 135 |         $targetPage = (int)$this->getValueByPathOrDefaultValue('plugin.tx_solr.search.targetPage', 0); | |
| 1607 | 135 |         if ($targetPage === 0) { | |
| 1608 | // when no specific page was configured we use the contextPageId (which is usual $GLOBALS['TSFE']->id) | ||
| 1609 | 82 | $targetPage = $this->contextPageId; | |
| 1610 | } | ||
| 1611 | |||
| 1612 | 135 | return $targetPage; | |
| 1613 | } | ||
| 1614 | |||
| 1615 | /** | ||
| 1616 | * Retrieves the targetPage configuration. | ||
| 1617 | * | ||
| 1618 | * plugin.tx_solr.search.targetPage. | ||
| 1619 | * | ||
| 1620 | * @param array $defaultIfEmpty | ||
| 1621 | * @return array | ||
| 1622 | */ | ||
| 1623 | 28 | public function getSearchTargetPageConfiguration(array $defaultIfEmpty = []) | |
| 1624 |     { | ||
| 1625 | 28 |         $result = $this->getObjectByPathOrDefault('plugin.tx_solr.search.targetPage.', $defaultIfEmpty); | |
| 1626 | 28 | return $result; | |
| 1627 | } | ||
| 1628 | |||
| 1629 | /** | ||
| 1630 | * Retrieves the pagebrowser configuration. | ||
| 1631 | * | ||
| 1632 | * plugin.tx_solr.search.results.pagebrowser. | ||
| 1633 | * | ||
| 1634 | * @param array $defaultIfEmpty | ||
| 1635 | * @return array | ||
| 1636 | */ | ||
| 1637 | 18 | public function getSearchResultsPageBrowserConfiguration(array $defaultIfEmpty = []) | |
| 1638 |     { | ||
| 1639 | 18 |         $result = $this->getObjectByPathOrDefault('plugin.tx_solr.search.results.pagebrowser.', $defaultIfEmpty); | |
| 1640 | 18 | return $result; | |
| 1641 | } | ||
| 1642 | |||
| 1643 | /** | ||
| 1644 | * Returns the result highlighting fields. | ||
| 1645 | * | ||
| 1646 | * plugin.tx_solr.search.results.resultsHighlighting.highlightFields | ||
| 1647 | * | ||
| 1648 | * @param string $defaultIfEmpty | ||
| 1649 | * @return string | ||
| 1650 | */ | ||
| 1651 | 31 | public function getSearchResultsHighlightingFields($defaultIfEmpty = '') | |
| 1652 |     { | ||
| 1653 | 31 |         return $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.results.resultsHighlighting.highlightFields', $defaultIfEmpty); | |
| 1654 | } | ||
| 1655 | |||
| 1656 | /** | ||
| 1657 | * Returns the result highlighting fields as array. | ||
| 1658 | * | ||
| 1659 | * plugin.tx_solr.search.results.resultsHighlighting.highlightFields | ||
| 1660 | * | ||
| 1661 | * @param array $defaultIfEmpty | ||
| 1662 | * @return array | ||
| 1663 | */ | ||
| 1664 | 18 | public function getSearchResultsHighlightingFieldsAsArray($defaultIfEmpty = []) | |
| 1665 |     { | ||
| 1666 | 18 |         $highlightingFields = $this->getSearchResultsHighlightingFields(''); | |
| 1667 | |||
| 1668 | 18 |         if ($highlightingFields === '') { | |
| 1669 | return $defaultIfEmpty; | ||
| 1670 | } | ||
| 1671 | |||
| 1672 | 18 |         return GeneralUtility::trimExplode(',', $highlightingFields, true); | |
| 1673 | } | ||
| 1674 | |||
| 1675 | /** | ||
| 1676 | * Returns the fragmentSeparator for highlighted segments. | ||
| 1677 | * | ||
| 1678 | * plugin.tx_solr.search.results.resultsHighlighting.fragmentSeparator | ||
| 1679 | * | ||
| 1680 | * @param string $defaultIfEmpty | ||
| 1681 | * @return string | ||
| 1682 | */ | ||
| 1683 | 18 | public function getSearchResultsHighlightingFragmentSeparator($defaultIfEmpty = '[...]') | |
| 1684 |     { | ||
| 1685 | 18 |         return $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.results.resultsHighlighting.fragmentSeparator', $defaultIfEmpty); | |
| 1686 | } | ||
| 1687 | |||
| 1688 | /** | ||
| 1689 | * Returns the number of results that should be shown per page. | ||
| 1690 | * | ||
| 1691 | * plugin.tx_solr.search.results.resultsPerPage | ||
| 1692 | * | ||
| 1693 | * @param int $defaultIfEmpty | ||
| 1694 | * @return int | ||
| 1695 | */ | ||
| 1696 | 24 | public function getSearchResultsPerPage($defaultIfEmpty = 10) | |
| 1697 |     { | ||
| 1698 | 24 |         return (int)$this->getValueByPathOrDefaultValue('plugin.tx_solr.search.results.resultsPerPage', $defaultIfEmpty); | |
| 1699 | } | ||
| 1700 | |||
| 1701 | /** | ||
| 1702 | * Returns the available options for the per page switch. | ||
| 1703 | * | ||
| 1704 | * plugin.tx_solr.search.results.resultsPerPageSwitchOptions | ||
| 1705 | * | ||
| 1706 | * @param array $defaultIfEmpty | ||
| 1707 | * @return array | ||
| 1708 | */ | ||
| 1709 | 24 | public function getSearchResultsPerPageSwitchOptionsAsArray($defaultIfEmpty = []) | |
| 1710 |     { | ||
| 1711 | 24 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.results.resultsPerPageSwitchOptions', ''); | |
| 1712 | |||
| 1713 | 24 |         if (trim($result) === '') { | |
| 1714 | return $defaultIfEmpty; | ||
| 1715 | } | ||
| 1716 | |||
| 1717 | 24 |         return GeneralUtility::intExplode(',', $result, true); | |
| 1718 | } | ||
| 1719 | |||
| 1720 | /** | ||
| 1721 | * Returns the configured wrap for the resultHighlighting. | ||
| 1722 | * | ||
| 1723 | * plugin.tx_solr.search.results.resultsHighlighting.wrap | ||
| 1724 | * | ||
| 1725 | * @param string $defaultIfEmpty | ||
| 1726 | * @return string | ||
| 1727 | */ | ||
| 1728 | 31 | public function getSearchResultsHighlightingWrap($defaultIfEmpty = '') | |
| 1729 |     { | ||
| 1730 | 31 |         return $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.results.resultsHighlighting.wrap', $defaultIfEmpty); | |
| 1731 | } | ||
| 1732 | |||
| 1733 | /** | ||
| 1734 | * Indicates if spellchecking is enabled or not. | ||
| 1735 | * | ||
| 1736 | * plugin.tx_solr.search.spellchecking | ||
| 1737 | * | ||
| 1738 | * @param bool $defaultIfEmpty | ||
| 1739 | * @return bool | ||
| 1740 | */ | ||
| 1741 | 25 | public function getSearchSpellchecking($defaultIfEmpty = false) | |
| 1742 |     { | ||
| 1743 | 25 |         $isFacetingEnabled = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.spellchecking', $defaultIfEmpty); | |
| 1744 | 25 | return $this->getBool($isFacetingEnabled); | |
| 1745 | } | ||
| 1746 | |||
| 1747 | /** | ||
| 1748 | * Returns the wrap that should be used for spellchecking | ||
| 1749 | * | ||
| 1750 | * plugin.tx_solr.search.spellchecking.wrap | ||
| 1751 | * | ||
| 1752 | * @param string $defaultIfEmpty | ||
| 1753 | * @return string | ||
| 1754 | */ | ||
| 1755 | 5 | public function getSearchSpellcheckingWrap($defaultIfEmpty = '') | |
| 1756 |     { | ||
| 1757 | 5 |         return (string)$this->getValueByPathOrDefaultValue('plugin.tx_solr.search.spellchecking.wrap', $defaultIfEmpty); | |
| 1758 | } | ||
| 1759 | |||
| 1760 | /** | ||
| 1761 | * Returns the numberOfSuggestionsToTry that should be used for the spellchecking. | ||
| 1762 | * | ||
| 1763 | * plugin.tx_solr.search.spellchecking.numberOfSuggestionsToTry | ||
| 1764 | * | ||
| 1765 | * @param int $defaultIfEmpty | ||
| 1766 | * @return int | ||
| 1767 | */ | ||
| 1768 | 22 | public function getSearchSpellcheckingNumberOfSuggestionsToTry($defaultIfEmpty = 0) | |
| 1769 |     { | ||
| 1770 | 22 |         return (int)$this->getValueByPathOrDefaultValue('plugin.tx_solr.search.spellchecking.numberOfSuggestionsToTry', $defaultIfEmpty); | |
| 1771 | } | ||
| 1772 | |||
| 1773 | /** | ||
| 1774 | * Indicates if a second search should be fired from the spellchecking suggestion if no results could be found. | ||
| 1775 | * | ||
| 1776 | * plugin.tx_solr.search.spellchecking.searchUsingSpellCheckerSuggestion | ||
| 1777 | * | ||
| 1778 | * @param bool $defaultIfEmpty | ||
| 1779 | * @return bool | ||
| 1780 | */ | ||
| 1781 | 3 | public function getSearchSpellcheckingSearchUsingSpellCheckerSuggestion($defaultIfEmpty = false) | |
| 1782 |     { | ||
| 1783 | 3 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.spellchecking.searchUsingSpellCheckerSuggestion', $defaultIfEmpty); | |
| 1784 | 3 | return $this->getBool($result); | |
| 1785 | } | ||
| 1786 | |||
| 1787 | /** | ||
| 1788 | * Indicates if faceting is enabled or not. | ||
| 1789 | * | ||
| 1790 | * plugin.tx_solr.search.faceting | ||
| 1791 | * | ||
| 1792 | * @param bool $defaultIfEmpty | ||
| 1793 | * @return bool | ||
| 1794 | */ | ||
| 1795 | 20 | public function getSearchFaceting($defaultIfEmpty = false) | |
| 1800 | |||
| 1801 | /** | ||
| 1802 | * Retrieves the facetLinkATagParams for a facet by facet name. If nothing specific is configured | ||
| 1803 | * the global facetLinkATagParams with be returned. | ||
| 1804 | * | ||
| 1805 | * plugin.tx_solr.search.faceting.facets.<facetName>.facetLinkATagParams | ||
| 1806 | * | ||
| 1807 | * or | ||
| 1808 | * | ||
| 1809 | * plugin.tx_solr.search.faceting.facetLinkATagParams | ||
| 1810 | * | ||
| 1811 | * | ||
| 1812 | * @param string $facetName | ||
| 1813 | * @param string $defaultIfEmpty | ||
| 1814 | * @return string | ||
| 1815 | */ | ||
| 1816 | 19 | public function getSearchFacetingFacetLinkATagParamsByName($facetName = '', $defaultIfEmpty = '') | |
| 1831 | |||
| 1832 | /** | ||
| 1833 | * Returns the test that should be used to remove a faceting link | ||
| 1834 | * | ||
| 1835 | * plugin.tx_solr.search.faceting.removeFacetLinkText | ||
| 1836 | * | ||
| 1837 | * @param string $defaultIfEmpty | ||
| 1838 | * @return string | ||
| 1839 | */ | ||
| 1840 | 1 | public function getSearchFacetingRemoveFacetLinkText($defaultIfEmpty = '@facetLabel: @facetText') | |
| 1844 | |||
| 1845 | /** | ||
| 1846 | * Retrieves the showEvenWhenEmpty for a facet by facet name. If nothing specific is configured | ||
| 1847 | * the global showEmptyFacets with be returned. | ||
| 1848 | * | ||
| 1849 | * plugin.tx_solr.search.faceting.facets.<facetName>.showEvenWhenEmpty | ||
| 1850 | * | ||
| 1851 | * or | ||
| 1852 | * | ||
| 1853 | * plugin.tx_solr.search.faceting.showEmptyFacets | ||
| 1854 | * | ||
| 1855 | * | ||
| 1856 | * @param string $facetName | ||
| 1857 | * @param bool $defaultIfEmpty | ||
| 1858 | * @return bool | ||
| 1859 | */ | ||
| 1860 | 19 | public function getSearchFacetingShowEmptyFacetsByName($facetName = '', $defaultIfEmpty = false) | |
| 1875 | |||
| 1876 | /** | ||
| 1877 | * Returns the wrap for the faceting show all link | ||
| 1878 | * | ||
| 1879 | * plugin.tx_solr.search.faceting.showAllLink.wrap | ||
| 1880 | * | ||
| 1881 | * @param string $defaultIfEmpty | ||
| 1882 | * @return string | ||
| 1883 | */ | ||
| 1884 | public function getSearchFacetingShowAllLinkWrap($defaultIfEmpty = '') | ||
| 1888 | |||
| 1889 | /** | ||
| 1890 | * Returns the link url parameters that should be added to a facet. | ||
| 1891 | * | ||
| 1892 | * plugin.tx_solr.search.faceting.facetLinkUrlParameters | ||
| 1893 | * | ||
| 1894 | * @param string $defaultIfEmpty | ||
| 1895 | * @return string | ||
| 1896 | */ | ||
| 1897 | 18 | public function getSearchFacetingFacetLinkUrlParameters($defaultIfEmpty = '') | |
| 1903 | |||
| 1904 | /** | ||
| 1905 | * Returns if the facetLinkUrlsParameters should be included in the reset link. | ||
| 1906 | * | ||
| 1907 | * plugin.tx_solr.search.faceting.facetLinkUrlParameters.useForFacetResetLinkUrl | ||
| 1908 | * | ||
| 1909 | * @param bool $defaultIfEmpty | ||
| 1910 | * @return bool | ||
| 1911 | */ | ||
| 1912 | 18 | public function getSearchFacetingFacetLinkUrlParametersUseForFacetResetLinkUrl($defaultIfEmpty = true) | |
| 1917 | |||
| 1918 | /** | ||
| 1919 | * Returns the link url parameters that should be added to a facet as array. | ||
| 1920 | * | ||
| 1921 | * plugin.tx_solr.search.faceting.facetLinkUrlParameters | ||
| 1922 | * | ||
| 1923 | * @param array $defaultIfEmpty | ||
| 1924 | * @return array | ||
| 1925 | */ | ||
| 1926 | 18 | public function getSearchFacetingFacetLinkUrlParametersAsArray($defaultIfEmpty = []) | |
| 1935 | |||
| 1936 | /** | ||
| 1937 | * Return the configured minimumCount value for facets. | ||
| 1938 | * | ||
| 1939 | * plugin.tx_solr.search.faceting.minimumCount | ||
| 1940 | * | ||
| 1941 | * @param int $defaultIfEmpty | ||
| 1942 | * @return int | ||
| 1943 | */ | ||
| 1944 | 31 | public function getSearchFacetingMinimumCount($defaultIfEmpty = 1) | |
| 1948 | |||
| 1949 | /** | ||
| 1950 | * Return the configured limit value for facets, used for displaying. | ||
| 1951 | * | ||
| 1952 | * plugin.tx_solr.search.faceting.limit | ||
| 1953 | * | ||
| 1954 | * @param int $defaultIfEmpty | ||
| 1955 | * @return int | ||
| 1956 | */ | ||
| 1957 | 18 | public function getSearchFacetingLimit($defaultIfEmpty = 10) | |
| 1961 | |||
| 1962 | /** | ||
| 1963 | * Return the configured limit value for facets, used for the response. | ||
| 1964 | * | ||
| 1965 | * plugin.tx_solr.search.faceting.facetLimit | ||
| 1966 | * | ||
| 1967 | * @param int $defaultIfEmpty | ||
| 1968 | * @return int | ||
| 1969 | */ | ||
| 1970 | 31 | public function getSearchFacetingFacetLimit($defaultIfEmpty = 100) | |
| 1974 | |||
| 1975 | /** | ||
| 1976 | * Returns if the singleFacetMode is active or not. | ||
| 1977 | * | ||
| 1978 | * plugin.tx_solr.search.faceting.singleFacetMode | ||
| 1979 | * | ||
| 1980 | * @param bool $defaultIfEmpty | ||
| 1981 | * @return bool | ||
| 1982 | */ | ||
| 1983 | 1 | public function getSearchFacetingSingleFacetMode($defaultIfEmpty = false) | |
| 1988 | |||
| 1989 | /** | ||
| 1990 | * Return the configured faceting sortBy value. | ||
| 1991 | * | ||
| 1992 | * plugin.tx_solr.search.faceting.sortBy | ||
| 1993 | * | ||
| 1994 | * @param string $defaultIfEmpty | ||
| 1995 | * @return string | ||
| 1996 | */ | ||
| 1997 | 31 | public function getSearchFacetingSortBy($defaultIfEmpty = '') | |
| 2001 | |||
| 2002 | /** | ||
| 2003 | * Returns if a facets should be kept on selection. Global faceting setting | ||
| 2004 | * can also be configured on facet level by using | ||
| 2005 | * (plugin.tx_solr.search.faceting.facets.<fieldName>.keepAllOptionsOnSelection) | ||
| 2006 | * | ||
| 2007 | * plugin.tx_solr.search.faceting.keepAllFacetsOnSelection | ||
| 2008 | * | ||
| 2009 | * @param bool $defaultIfEmpty | ||
| 2010 | * @return bool | ||
| 2011 | */ | ||
| 2012 | 27 | public function getSearchFacetingKeepAllFacetsOnSelection($defaultIfEmpty = false) | |
| 2017 | |||
| 2018 | /** | ||
| 2019 | * Returns the configured faceting configuration. | ||
| 2020 | * | ||
| 2021 | * plugin.tx_solr.search.faceting.facets | ||
| 2022 | * | ||
| 2023 | * @param array $defaultIfEmpty | ||
| 2024 | * @return array | ||
| 2025 | */ | ||
| 2026 | 27 | public function getSearchFacetingFacets(array $defaultIfEmpty = []) | |
| 2030 | |||
| 2031 | /** | ||
| 2032 | * Returns the configuration of a single facet by facet name. | ||
| 2033 | * | ||
| 2034 | * plugin.tx_solr.search.faceting.facets.<facetName> | ||
| 2035 | * | ||
| 2036 | * @param string $facetName | ||
| 2037 | * @param array $defaultIfEmpty | ||
| 2038 | * @return array | ||
| 2039 | */ | ||
| 2040 | 18 | public function getSearchFacetingFacetByName($facetName, $defaultIfEmpty = []) | |
| 2044 | |||
| 2045 | /** | ||
| 2046 | * Indicates if statistics is enabled or not. | ||
| 2047 | * | ||
| 2048 | * plugin.tx_solr.statistics | ||
| 2049 | * | ||
| 2050 | * @param bool $defaultIfEmpty | ||
| 2051 | * @return bool | ||
| 2052 | */ | ||
| 2053 | 24 | public function getStatistics($defaultIfEmpty = false) | |
| 2058 | |||
| 2059 | /** | ||
| 2060 | * Indicates to which length an ip should be anonymized in the statistics | ||
| 2061 | * | ||
| 2062 | * plugin.tx_solr.statistics.anonymizeIP | ||
| 2063 | * | ||
| 2064 | * @param int $defaultIfEmpty | ||
| 2065 | * @return int | ||
| 2066 | */ | ||
| 2067 | 18 | public function getStatisticsAnonymizeIP($defaultIfEmpty = 0) | |
| 2072 | |||
| 2073 | /** | ||
| 2074 | * Indicates if additional debug Data should be added to the statistics | ||
| 2075 | * | ||
| 2076 | * plugin.tx_solr.statistics.addDebugData | ||
| 2077 | * | ||
| 2078 | * @param bool $defaultIfEmpty | ||
| 2079 | * @return bool | ||
| 2080 | */ | ||
| 2081 | 20 | public function getStatisticsAddDebugData($defaultIfEmpty = false) | |
| 2086 | |||
| 2087 | /** | ||
| 2088 | * Indicates if suggestion is enabled or not. | ||
| 2089 | * | ||
| 2090 | * plugin.tx_solr.suggest | ||
| 2091 | * | ||
| 2092 | * @param bool $defaultIfEmpty | ||
| 2093 | * @return bool | ||
| 2094 | */ | ||
| 2095 | 25 | public function getSuggest($defaultIfEmpty = false) | |
| 2100 | |||
| 2101 | /** | ||
| 2102 | * Indicates if https should be used for the suggest form. | ||
| 2103 | * | ||
| 2104 | * plugin.tx_solr.suggest.forceHttps | ||
| 2105 | * | ||
| 2106 | * @param bool $defaultIfEmpty | ||
| 2107 | * @return bool | ||
| 2108 | */ | ||
| 2109 | 25 | public function getSuggestForceHttps($defaultIfEmpty = false) | |
| 2114 | |||
| 2115 | /** | ||
| 2116 | * Returns the configured template for a specific template fileKey. | ||
| 2117 | * | ||
| 2118 | * plugin.tx_solr.search.templateFiles.<fileKey> | ||
| 2119 | * | ||
| 2120 | * @param string $fileKey | ||
| 2121 | * @param string $defaultIfEmpty | ||
| 2122 | * @return string | ||
| 2123 | */ | ||
| 2124 | 25 | public function getTemplateByFileKey($fileKey, $defaultIfEmpty = '') | |
| 2129 | |||
| 2130 | /** | ||
| 2131 | * Returns the configuration of the crop view helper. | ||
| 2132 | * | ||
| 2133 | * plugin.tx_solr.viewHelpers.crop. | ||
| 2134 | * | ||
| 2135 | * @param array $defaultIfEmpty | ||
| 2136 | * @return array | ||
| 2137 | */ | ||
| 2138 | 1 | public function getViewHelpersCropConfiguration(array $defaultIfEmpty = []) | |
| 2143 | |||
| 2144 | /** | ||
| 2145 | * Returns the configuration of the sorting view helper. | ||
| 2146 | * | ||
| 2147 | * plugin.tx_solr.viewHelpers.sortIndicator. | ||
| 2148 | * | ||
| 2149 | * @param array $defaultIfEmpty | ||
| 2150 | * @return array | ||
| 2151 | */ | ||
| 2152 | 17 | public function getViewHelpersSortIndicatorConfiguration(array $defaultIfEmpty = []) | |
| 2157 | |||
| 2158 | /** | ||
| 2159 | * Controls whether ext-solr will send commits to solr. | ||
| 2160 | * Beware: If you disable this, you need to ensure | ||
| 2161 | * that some other mechanism will commit your changes | ||
| 2162 | * otherwise they will never be searchable. | ||
| 2163 | * A good way to achieve this is enabling the solr | ||
| 2164 | * daemons autoCommit feature. | ||
| 2165 | * | ||
| 2166 | * plugin.tx_solr.index.enableCommits | ||
| 2167 | * | ||
| 2168 | * @param bool $defaultIfEmpty | ||
| 2169 | * @return bool | ||
| 2170 | */ | ||
| 2171 | 11 | public function getEnableCommits($defaultIfEmpty = true) | |
| 2176 | |||
| 2177 | /* | ||
| 2178 | * Applies the stdWrap if it is configured for the path, otherwise the unprocessed value will be returned. | ||
| 2179 | * | ||
| 2180 | * @param string $valuePath | ||
| 2181 | * @param mixed $value | ||
| 2182 | * @return mixed | ||
| 2183 | */ | ||
| 2184 | 7 | protected function renderContentElementOfConfigured($valuePath, $value) | |
| 2195 | } | ||
| 2196 |