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 | 255 | 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 | 249 | 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 | 11 | 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 | 287 | public function getValueByPath($path) | |
| 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 | 284 | public function getValueByPathOrDefaultValue($path, $defaultValue) | |
| 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 | 177 | public function getObjectByPath($path) | |
| 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 | 172 | public function getObjectByPathOrDefault($path, array $defaultValue) | |
| 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) | ||
| 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 | 16 | public function mergeSolrConfiguration(array $configurationToMerge, $addKeys = true, $includeEmptyValues = true, $enableUnsetFeature = true) | |
| 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) | |
| 279 | |||
| 280 | /** | ||
| 281 | * Returns the configured additionalFields configured for the indexing. | ||
| 282 | * | ||
| 283 | * plugin.tx_solr.index.additionalFields. | ||
| 284 | * | ||
| 285 | * @param array $defaultIfEmpty | ||
| 286 | * @return array | ||
| 287 | */ | ||
| 288 | 3 | public function getIndexAdditionalFieldsConfiguration($defaultIfEmpty = []) | |
| 293 | |||
| 294 | /** | ||
| 295 | * Returns all solr fields names where a mapping is configured in index.additionalFields | ||
| 296 | * | ||
| 297 | * Returns all keys from | ||
| 298 | * plugin.tx_solr.index.additionalFields. | ||
| 299 | * | ||
| 300 | * @param array $defaultIfEmpty | ||
| 301 | * @return array | ||
| 302 | */ | ||
| 303 | 2 | public function getIndexMappedAdditionalFieldNames($defaultIfEmpty = []) | |
| 309 | |||
| 310 | /** | ||
| 311 | * Returns the fieldProcessingInstructions configuration array | ||
| 312 | * | ||
| 313 | * plugin.tx_solr.index.fieldProcessingInstructions. | ||
| 314 | * | ||
| 315 | * @param array $defaultIfEmpty | ||
| 316 | * @return array | ||
| 317 | */ | ||
| 318 | 69 | public function getIndexFieldProcessingInstructionsConfiguration(array $defaultIfEmpty = []) | |
| 323 | |||
| 324 | /** | ||
| 325 | * Retrieves the indexing configuration array for an indexing queue by configuration name. | ||
| 326 | * | ||
| 327 | * plugin.tx_solr.index.queue.<configurationName>. | ||
| 328 | * | ||
| 329 | * @param string $configurationName | ||
| 330 | * @param array $defaultIfEmpty | ||
| 331 | * @return array | ||
| 332 | */ | ||
| 333 | 6 | public function getIndexQueueConfigurationByName($configurationName, array $defaultIfEmpty = []) | |
| 339 | |||
| 340 | /** | ||
| 341 | * Returns an array of all additionalPageIds by index configuration name. | ||
| 342 | * | ||
| 343 | * plugin.tx_solr.index.queue.pages.additionalPageIds | ||
| 344 | * | ||
| 345 | * @param string $configurationName | ||
| 346 | * @param array $defaultIfEmpty | ||
| 347 | * @return array | ||
| 348 | */ | ||
| 349 | 39 | public function getIndexQueueAdditionalPageIdsByConfigurationName($configurationName = 'pages', $defaultIfEmpty = []) | |
| 359 | |||
| 360 | /** | ||
| 361 | * Returns an array of all allowedPageTypes. | ||
| 362 | * | ||
| 363 | * plugin.tx_solr.index.queue.pages.allowedPageTypes | ||
| 364 | * | ||
| 365 | * @param string $configurationName The configuration name of the queue to use. | ||
| 366 | * @param array $defaultIfEmpty | ||
| 367 | * @return array | ||
| 368 | */ | ||
| 369 | 30 | public function getIndexQueueAllowedPageTypesArrayByConfigurationName($configurationName = 'pages', $defaultIfEmpty = []) | |
| 379 | |||
| 380 | /** | ||
| 381 | * Returns the configured excludeContentByClass patterns as array. | ||
| 382 | * | ||
| 383 | * plugin.tx_solr.index.queue.pages.excludeContentByClass | ||
| 384 | * | ||
| 385 | * @param array $defaultIfEmpty | ||
| 386 | * @return array | ||
| 387 | */ | ||
| 388 | 44 | public function getIndexQueuePagesExcludeContentByClassArray($defaultIfEmpty = []) | |
| 399 | |||
| 400 | /** | ||
| 401 | * Returns the configured database table for an indexing queue configuration or | ||
| 402 | * the configurationName itself that is used by convention as tableName when no | ||
| 403 | * other tablename is present. | ||
| 404 | * | ||
| 405 | * plugin.tx_solr.index.queue.<configurationName>.table or configurationName | ||
| 406 | * | ||
| 407 | * @param string $configurationName | ||
| 408 | * @return string | ||
| 409 | */ | ||
| 410 | 68 | public function getIndexQueueTableNameOrFallbackToConfigurationName($configurationName = '') | |
| 416 | |||
| 417 | /** | ||
| 418 | * Returns the field configuration for a specific index queue. | ||
| 419 | * | ||
| 420 | * plugin.tx_solr.index.queue.<configurationName>.fields. | ||
| 421 | * | ||
| 422 | * @param string $configurationName | ||
| 423 | * @param array $defaultIfEmpty | ||
| 424 | * @return array | ||
| 425 | */ | ||
| 426 | 27 | public function getIndexQueueFieldsConfigurationByConfigurationName($configurationName = '', $defaultIfEmpty = []) | |
| 432 | |||
| 433 | /** | ||
| 434 | * Gets an array of tables configured for indexing by the Index Queue. Since the | ||
| 435 | * record monitor must watch these tables for manipulation. | ||
| 436 | * | ||
| 437 | * @return array Array of table names to be watched by the record monitor. | ||
| 438 | */ | ||
| 439 | 35 | public function getIndexQueueMonitoredTables() | |
| 455 | |||
| 456 | /** | ||
| 457 | * This method can be used to check if a table is configured to be monitored by the record monitor. | ||
| 458 | * | ||
| 459 | * @param string $tableName | ||
| 460 | * @return bool | ||
| 461 | */ | ||
| 462 | 34 | public function getIndexQueueIsMonitoredTable($tableName) | |
| 466 | |||
| 467 | /** | ||
| 468 | * Returns the configured indexer class that should be used for a certain indexingConfiguration. | ||
| 469 | * By default "ApacheSolrForTypo3\Solr\IndexQueue\Indexer" will be returned. | ||
| 470 | * | ||
| 471 | * plugin.tx_solr.index.queue.<configurationName>.indexer | ||
| 472 | * | ||
| 473 | * @param string $configurationName | ||
| 474 | * @param string $defaultIfEmpty | ||
| 475 | * @return string | ||
| 476 | */ | ||
| 477 | 6 | public function getIndexQueueIndexerByConfigurationName($configurationName, $defaultIfEmpty = Indexer::class) | |
| 483 | |||
| 484 | /** | ||
| 485 | * Returns the configuration of an indexer for a special indexingConfiguration. By default an empty | ||
| 486 | * array is returned. | ||
| 487 | * | ||
| 488 | * plugin.tx_solr.index.queue.<configurationName>.indexer. | ||
| 489 | * | ||
| 490 | * @param string $configurationName | ||
| 491 | * @param array $defaultIfEmpty | ||
| 492 | * @return array | ||
| 493 | */ | ||
| 494 | 6 | public function getIndexQueueIndexerConfigurationByConfigurationName($configurationName, $defaultIfEmpty = []) | |
| 500 | |||
| 501 | /** | ||
| 502 | * Returns all solr fields names where a mapping configuration is set for a certain index configuration | ||
| 503 | * | ||
| 504 | * Returns all keys from | ||
| 505 | * plugin.tx_solr.index.queue.<configurationName>.fields. | ||
| 506 | * | ||
| 507 | * @param string $configurationName | ||
| 508 | * @param array $defaultIfEmpty | ||
| 509 | * @return array | ||
| 510 | */ | ||
| 511 | 10 | public function getIndexQueueMappedFieldsByConfigurationName($configurationName = '', $defaultIfEmpty = []) | |
| 517 | |||
| 518 | /** | ||
| 519 | * This method is used to check if an index queue configuration is enabled or not | ||
| 520 | * | ||
| 521 | * plugin.tx_solr.index.queue.<configurationName> = 1 | ||
| 522 | * | ||
| 523 | * @param string $configurationName | ||
| 524 | * @param bool $defaultIfEmpty | ||
| 525 | * @return bool | ||
| 526 | */ | ||
| 527 | 63 | public function getIndexQueueConfigurationIsEnabled($configurationName, $defaultIfEmpty = false) | |
| 533 | |||
| 534 | /** | ||
| 535 | * Retrieves an array of enabled index queue configurations. | ||
| 536 | * | ||
| 537 | * plugin.tx_solr.index.queue.<configurationName> | ||
| 538 | * | ||
| 539 | * @param array $defaultIfEmpty | ||
| 540 | * @return array | ||
| 541 | */ | ||
| 542 | 70 | public function getEnabledIndexQueueConfigurationNames($defaultIfEmpty = []) | |
| 555 | |||
| 556 | /** | ||
| 557 | * Retrieves an array of additional fields that will trigger an recursive update of pages | ||
| 558 | * when some of the fields on that page are modified. | ||
| 559 | * | ||
| 560 | * plugin.tx_solr.index.queue.recursiveUpdateFields | ||
| 561 | * | ||
| 562 | * @param string $configurationName | ||
| 563 | * @param array $defaultIfEmpty | ||
| 564 | * @return array | ||
| 565 | */ | ||
| 566 | 26 | public function getIndexQueueConfigurationRecursiveUpdateFields($configurationName, $defaultIfEmpty = []) | |
| 577 | |||
| 578 | |||
| 579 | /** | ||
| 580 | * Retrieves and initialPagesAdditionalWhereClause where clause when configured or an empty string. | ||
| 581 | * | ||
| 582 | * plugin.tx_solr.index.queue.<configurationName>.initialPagesAdditionalWhereClause | ||
| 583 | * | ||
| 584 | * @param string $configurationName | ||
| 585 | * @return string | ||
| 586 | */ | ||
| 587 | 13 | public function getInitialPagesAdditionalWhereClause($configurationName) | |
| 598 | |||
| 599 | /** | ||
| 600 | * Retrieves and additional where clause when configured or an empty string. | ||
| 601 | * | ||
| 602 | * plugin.tx_solr.index.queue.<configurationName>.additionalWhereClause | ||
| 603 | * | ||
| 604 | * @param string $configurationName | ||
| 605 | * @return string | ||
| 606 | */ | ||
| 607 | 66 | public function getIndexQueueAdditionalWhereClauseByConfigurationName($configurationName) | |
| 618 | |||
| 619 | /** | ||
| 620 | * This method can be used to retrieve all index queue configuration names, where | ||
| 621 | * a certain table is used. It can be configured with the property "table" or is using the configuration | ||
| 622 | * key a fallback for the table name. | ||
| 623 | * | ||
| 624 | * plugin.tx_solr.index.queue.<configurationName>. | ||
| 625 | * | ||
| 626 | * @param string $tableName | ||
| 627 | * @param array $defaultIfEmpty | ||
| 628 | * @return array | ||
| 629 | */ | ||
| 630 | 1 | public function getIndexQueueConfigurationNamesByTableName($tableName, $defaultIfEmpty = []) | |
| 653 | |||
| 654 | /** | ||
| 655 | * This method is used to retrieve the className of a queue initializer for a certain indexing configuration | ||
| 656 | * of returns the default initializer class, when noting is configured. | ||
| 657 | * | ||
| 658 | * plugin.tx_solr.index.queue.<configurationName>.initialization | ||
| 659 | * | ||
| 660 | * @param string $configurationName | ||
| 661 | * @param string $defaultIfEmpty | ||
| 662 | * @return string | ||
| 663 | */ | ||
| 664 | 6 | public function getIndexQueueInitializerClassByConfigurationName($configurationName, $defaultIfEmpty = Record::class) | |
| 671 | |||
| 672 | /** | ||
| 673 | * Returns the _LOCAL_LANG configuration from the TypoScript. | ||
| 674 | * | ||
| 675 | * plugin.tx_solr._LOCAL_LANG. | ||
| 676 | * | ||
| 677 | * @param array $defaultIfEmpty | ||
| 678 | * @return array | ||
| 679 | */ | ||
| 680 | public function getLocalLangConfiguration(array $defaultIfEmpty = []) | ||
| 685 | |||
| 686 | /** | ||
| 687 | * When this is enabled the output of the devlog, will be printed as debug output. | ||
| 688 | * | ||
| 689 | * @param bool $defaultIfEmpty | ||
| 690 | * @return bool | ||
| 691 | */ | ||
| 692 | public function getLoggingDebugOutput($defaultIfEmpty = false) | ||
| 697 | |||
| 698 | /** | ||
| 699 | * Returns if query filters should be written to the log. | ||
| 700 | * | ||
| 701 | * plugin.tx_solr.logging.query.filters | ||
| 702 | * | ||
| 703 | * @param bool $defaultIfEmpty | ||
| 704 | * @return bool | ||
| 705 | */ | ||
| 706 | public function getLoggingQueryFilters($defaultIfEmpty = false) | ||
| 707 |     { | ||
| 708 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.logging.query.filters', $defaultIfEmpty); | ||
| 709 | return $this->getBool($result); | ||
| 710 | } | ||
| 711 | |||
| 712 | /** | ||
| 713 | * Returns if the querystring should be logged or not. | ||
| 714 | * | ||
| 715 | * plugin.tx_solr.logging.query.queryString | ||
| 716 | * | ||
| 717 | * @param bool $defaultIfEmpty | ||
| 718 | * @return bool | ||
| 719 | */ | ||
| 720 | 33 | public function getLoggingQueryQueryString($defaultIfEmpty = false) | |
| 725 | |||
| 726 | /** | ||
| 727 | * Returns if the searchWords should be logged or not. | ||
| 728 | * | ||
| 729 | * plugin.tx_solr.logging.query.searchWords | ||
| 730 | * | ||
| 731 | * @param bool $defaultIfEmpty | ||
| 732 | * @return bool | ||
| 733 | */ | ||
| 734 | 30 | public function getLoggingQuerySearchWords($defaultIfEmpty = false) | |
| 739 | |||
| 740 | /** | ||
| 741 | * Returns if the rawGet requests should be logged or not. | ||
| 742 | * | ||
| 743 | * plugin.tx_solr.logging.query.rawGet | ||
| 744 | * | ||
| 745 | * @param bool $defaultIfEmpty | ||
| 746 | * @return bool | ||
| 747 | */ | ||
| 748 | 48 | public function getLoggingQueryRawGet($defaultIfEmpty = false) | |
| 753 | |||
| 754 | /** | ||
| 755 | * Returns if the rawPost requests should be logged or not. | ||
| 756 | * | ||
| 757 | * plugin.tx_solr.logging.query.rawPost | ||
| 758 | * | ||
| 759 | * @param bool $defaultIfEmpty | ||
| 760 | * @return bool | ||
| 761 | */ | ||
| 762 | 78 | public function getLoggingQueryRawPost($defaultIfEmpty = false) | |
| 767 | |||
| 768 | /** | ||
| 769 | * Returns if the rawDelete requests should be logged or not. | ||
| 770 | * | ||
| 771 | * plugin.tx_solr.logging.query.rawDelete | ||
| 772 | * | ||
| 773 | * @param bool $defaultIfEmpty | ||
| 774 | * @return bool | ||
| 775 | */ | ||
| 776 | 4 | public function getLoggingQueryRawDelete($defaultIfEmpty = false) | |
| 781 | |||
| 782 | /** | ||
| 783 | * Returns if exceptions should be logged or not. | ||
| 784 | * | ||
| 785 | * plugin.tx_solr.logging.exceptions | ||
| 786 | * | ||
| 787 | * @param bool $defaultIfEmpty | ||
| 788 | * @return bool | ||
| 789 | */ | ||
| 790 | 4 | public function getLoggingExceptions($defaultIfEmpty = true) | |
| 795 | |||
| 796 | /** | ||
| 797 | * Returns if indexing operations should be logged or not. | ||
| 798 | * | ||
| 799 | * plugin.tx_solr.logging.indexing | ||
| 800 | * | ||
| 801 | * @param bool $defaultIfEmpty | ||
| 802 | * @return bool | ||
| 803 | */ | ||
| 804 | 19 | public function getLoggingIndexing($defaultIfEmpty = false) | |
| 809 | |||
| 810 | /** | ||
| 811 | * Returns if indexing queue operations should be logged or not. | ||
| 812 | * | ||
| 813 | * plugin.tx_solr.logging.indexing.queue | ||
| 814 | * | ||
| 815 | * @param bool $defaultIfEmpty | ||
| 816 | * @return bool | ||
| 817 | */ | ||
| 818 | 18 | public function getLoggingIndexingQueue($defaultIfEmpty = false) | |
| 823 | |||
| 824 | /** | ||
| 825 | * This method can be used to check if the logging during indexing should be done. | ||
| 826 | * It takes the specific configuration by indexQueueConfiguration into account or is using the | ||
| 827 | * fallback when the logging is enabled on queue or indexing level. | ||
| 828 | * | ||
| 829 | * plugin.tx_solr.logging.indexing.queue.<indexQueueConfiguration> | ||
| 830 | * | ||
| 831 | * @param string $indexQueueConfiguration | ||
| 832 | * @param bool $defaultIfEmpty | ||
| 833 | * @return bool | ||
| 834 | */ | ||
| 835 | 19 | public function getLoggingIndexingQueueOperationsByConfigurationNameWithFallBack($indexQueueConfiguration, $defaultIfEmpty = false) | |
| 851 | |||
| 852 | /** | ||
| 853 | * Returns if a log message should be written when a page was indexed. | ||
| 854 | * | ||
| 855 | * plugin.tx_solr.logging.indexing.pageIndexed | ||
| 856 | * | ||
| 857 | * @param bool $defaultIfEmpty | ||
| 858 | * @return bool | ||
| 859 | */ | ||
| 860 | 9 | public function getLoggingIndexingPageIndexed($defaultIfEmpty = false) | |
| 865 | |||
| 866 | /** | ||
| 867 | * Returns if a log message should be written when the TYPO3 search markers are missing in the page. | ||
| 868 | * | ||
| 869 | * plugin.tx_solr.logging.indexing.missingTypo3SearchMarkers | ||
| 870 | * | ||
| 871 | * @param bool $defaultIfEmpty | ||
| 872 | * @return bool | ||
| 873 | */ | ||
| 874 | 10 | public function getLoggingIndexingMissingTypo3SearchMarkers($defaultIfEmpty = true) | |
| 879 | |||
| 880 | /** | ||
| 881 | * Returns if the initialization of an indexqueue should be logged. | ||
| 882 | * | ||
| 883 | * plugin.tx_solr.logging.indexing.indexQueueInitialization | ||
| 884 | * | ||
| 885 | * @param bool $defaultIfEmpty | ||
| 886 | * @return bool | ||
| 887 | */ | ||
| 888 | 12 | public function getLoggingIndexingIndexQueueInitialization($defaultIfEmpty = false) | |
| 893 | |||
| 894 | /** | ||
| 895 | * Indicates if the debug mode is enabled or not. | ||
| 896 | * | ||
| 897 | * plugin.tx_solr.enableDebugMode | ||
| 898 | * | ||
| 899 | * @param bool $defaultIfEmpty | ||
| 900 | * @return bool | ||
| 901 | */ | ||
| 902 | 30 | public function getEnabledDebugMode($defaultIfEmpty = false) | |
| 907 | |||
| 908 | /** | ||
| 909 | * Returns true or false if something is configured below plugin.tx_solr.solr. | ||
| 910 | * | ||
| 911 | * plugin.tx_solr.solr. | ||
| 912 | * | ||
| 913 | * @param boolean $defaultIfEmpty | ||
| 914 | * @return boolean | ||
| 915 | */ | ||
| 916 | 3 | public function getSolrHasConnectionConfiguration($defaultIfEmpty = false) | |
| 921 | |||
| 922 | /** | ||
| 923 | * Returns the defaultTimeout used for requests to the Solr server | ||
| 924 | * | ||
| 925 | * plugin.tx_solr.solr.timeout | ||
| 926 | * | ||
| 927 | * @param float $defaultIfEmpty | ||
| 928 | * @return float | ||
| 929 | */ | ||
| 930 | 102 | public function getSolrTimeout($defaultIfEmpty = 0.0) | |
| 934 | |||
| 935 | /** | ||
| 936 | * Returns the scheme used for requests to the Solr server | ||
| 937 | * | ||
| 938 | * plugin.tx_solr.solr.scheme | ||
| 939 | * | ||
| 940 | * Applies stdWrap on the configured setting | ||
| 941 | * | ||
| 942 | * @param string $defaultIfEmpty | ||
| 943 | * @return string | ||
| 944 | */ | ||
| 945 | 4 | public function getSolrScheme($defaultIfEmpty = 'http') | |
| 951 | |||
| 952 | /** | ||
| 953 | * Returns the hostname used for requests to the Solr server | ||
| 954 | * | ||
| 955 | * plugin.tx_solr.solr.host | ||
| 956 | * | ||
| 957 | * Applies stdWrap on the configured setting | ||
| 958 | * | ||
| 959 | * @param string $defaultIfEmpty | ||
| 960 | * @return string | ||
| 961 | */ | ||
| 962 | 7 | public function getSolrHost($defaultIfEmpty = 'localhost') | |
| 968 | |||
| 969 | /** | ||
| 970 | * Returns the port used for requests to the Solr server | ||
| 971 | * | ||
| 972 | * plugin.tx_solr.solr.port | ||
| 973 | * | ||
| 974 | * Applies stdWrap on the configured setting | ||
| 975 | * | ||
| 976 | * @param int $defaultIfEmpty | ||
| 977 | * @return int | ||
| 978 | */ | ||
| 979 | 4 | public function getSolrPort($defaultIfEmpty = 8983) | |
| 985 | |||
| 986 | /** | ||
| 987 | * Returns the path used for requests to the Solr server | ||
| 988 | * | ||
| 989 | * plugin.tx_solr.solr.path | ||
| 990 | * | ||
| 991 | * Applies stdWrap on the configured setting | ||
| 992 | * | ||
| 993 | * @param string $defaultIfEmpty | ||
| 994 | * @return string | ||
| 995 | */ | ||
| 996 | 7 | public function getSolrPath($defaultIfEmpty = '/solr/core_en/') | |
| 1007 | |||
| 1008 | /** | ||
| 1009 | * Returns the username used for requests to the Solr server | ||
| 1010 | * | ||
| 1011 | * plugin.tx_solr.solr.username | ||
| 1012 | * | ||
| 1013 | * Applies stdWrap on the configured setting | ||
| 1014 | * | ||
| 1015 | * @param string $defaultIfEmpty | ||
| 1016 | * @return string | ||
| 1017 | */ | ||
| 1018 | 4 | public function getSolrUsername($defaultIfEmpty = '') | |
| 1024 | |||
| 1025 | /** | ||
| 1026 | * Returns the password used for requests to the Solr server | ||
| 1027 | * | ||
| 1028 | * plugin.tx_solr.solr.password | ||
| 1029 | * | ||
| 1030 | * Applies stdWrap on the configured setting | ||
| 1031 | * | ||
| 1032 | * @param string $defaultIfEmpty | ||
| 1033 | * @return string | ||
| 1034 | */ | ||
| 1035 | 4 | public function getSolrPassword($defaultIfEmpty = '') | |
| 1041 | |||
| 1042 | /** | ||
| 1043 | * Retrieves the complete search configuration | ||
| 1044 | * | ||
| 1045 | * plugin.tx_solr.search. | ||
| 1046 | * | ||
| 1047 | * @param array $defaultIfEmpty | ||
| 1048 | * @return array | ||
| 1049 | */ | ||
| 1050 | 30 | public function getSearchConfiguration(array $defaultIfEmpty = []) | |
| 1055 | |||
| 1056 | /** | ||
| 1057 | * Indicates if elevation should be used or not | ||
| 1058 | * | ||
| 1059 | * plugin.tx_solr.search.elevation | ||
| 1060 | * | ||
| 1061 | * @param bool $defaultIfEmpty | ||
| 1062 | * @return bool | ||
| 1063 | */ | ||
| 1064 | 30 | public function getSearchElevation($defaultIfEmpty = false) | |
| 1069 | |||
| 1070 | /** | ||
| 1071 | * Indicates if elevated results should be marked | ||
| 1072 | * | ||
| 1073 | * plugin.tx_solr.search.elevation.markElevatedResults | ||
| 1074 | * | ||
| 1075 | * @param bool $defaultIfEmpty | ||
| 1076 | * @return bool | ||
| 1077 | */ | ||
| 1078 | 30 | public function getSearchElevationMarkElevatedResults($defaultIfEmpty = true) | |
| 1083 | |||
| 1084 | /** | ||
| 1085 | * Indicates if elevation should be forced | ||
| 1086 | * | ||
| 1087 | *plugin.tx_solr.search.elevation.forceElevation | ||
| 1088 | * | ||
| 1089 | * @param bool $defaultIfEmpty | ||
| 1090 | * @return bool | ||
| 1091 | */ | ||
| 1092 | 30 | public function getSearchElevationForceElevation($defaultIfEmpty = true) | |
| 1097 | |||
| 1098 | /** | ||
| 1099 | * Indicates if collapsing on a certain field should be used to build variants or not. | ||
| 1100 | * | ||
| 1101 | * plugin.tx_solr.search.variants | ||
| 1102 | * | ||
| 1103 | * @param bool $defaultIfEmpty | ||
| 1104 | * @return bool | ||
| 1105 | */ | ||
| 1106 | 121 | public function getSearchVariants($defaultIfEmpty = false) | |
| 1111 | |||
| 1112 | /** | ||
| 1113 | * Indicates if collapsing on a certain field should be used or not | ||
| 1114 | * | ||
| 1115 | * plugin.tx_solr.search.variants.variantField | ||
| 1116 | * | ||
| 1117 | * @param string $defaultIfEmpty | ||
| 1118 | * @return string | ||
| 1119 | */ | ||
| 1120 | 3 | public function getSearchVariantsField($defaultIfEmpty = 'variantId') | |
| 1124 | |||
| 1125 | /** | ||
| 1126 | * Indicates if expanding of collapsed items it activated. | ||
| 1127 | * | ||
| 1128 | * plugin.tx_solr.search.variants.expand | ||
| 1129 | * | ||
| 1130 | * @param bool $defaultIfEmpty | ||
| 1131 | * @return bool | ||
| 1132 | */ | ||
| 1133 | 5 | public function getSearchVariantsExpand($defaultIfEmpty = false) | |
| 1138 | |||
| 1139 | /** | ||
| 1140 | * Retrieves the number of elements that should be expanded. | ||
| 1141 | * | ||
| 1142 | * plugin.tx_solr.search.variants.limit | ||
| 1143 | * | ||
| 1144 | * @param int $defaultIfEmpty | ||
| 1145 | * @return int | ||
| 1146 | */ | ||
| 1147 | 2 | public function getSearchVariantsLimit($defaultIfEmpty = 10) | |
| 1152 | |||
| 1153 | /** | ||
| 1154 | * Indicates if frequent searches should be show or not. | ||
| 1155 | * | ||
| 1156 | * plugin.tx_solr.search.frequentSearches | ||
| 1157 | * | ||
| 1158 | * @param bool $defaultIfEmpty | ||
| 1159 | * @return bool | ||
| 1160 | */ | ||
| 1161 | 24 | public function getSearchFrequentSearches($defaultIfEmpty = false) | |
| 1162 |     { | ||
| 1163 | 24 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.frequentSearches', $defaultIfEmpty); | |
| 1164 | 24 | return $this->getBool($result); | |
| 1165 | } | ||
| 1166 | |||
| 1167 | /** | ||
| 1168 | * Returns the sub configuration of the frequentSearches | ||
| 1169 | * | ||
| 1170 | * plugin.tx_solr.search.frequentSearches. | ||
| 1171 | * | ||
| 1172 | * @param array $defaultIfEmpty | ||
| 1173 | * @return array | ||
| 1174 | */ | ||
| 1175 | 28 | public function getSearchFrequentSearchesConfiguration($defaultIfEmpty = []) | |
| 1180 | |||
| 1181 | /** | ||
| 1182 | * Retrieves the minimum font size that should be used for the frequentSearches. | ||
| 1183 | * | ||
| 1184 | * plugin.tx_solr.search.frequentSearches.minSize | ||
| 1185 | * | ||
| 1186 | * @param int $defaultIfEmpty | ||
| 1187 | * @return int | ||
| 1188 | */ | ||
| 1189 | 28 | public function getSearchFrequentSearchesMinSize($defaultIfEmpty = 14) | |
| 1194 | |||
| 1195 | /** | ||
| 1196 | * Retrieves the maximum font size that should be used for the frequentSearches. | ||
| 1197 | * | ||
| 1198 | * plugin.tx_solr.search.frequentSearches.minSize | ||
| 1199 | * | ||
| 1200 | * @param int $defaultIfEmpty | ||
| 1201 | * @return int | ||
| 1202 | */ | ||
| 1203 | 28 | public function getSearchFrequentSearchesMaxSize($defaultIfEmpty = 32) | |
| 1208 | |||
| 1209 | /** | ||
| 1210 | * Indicates if frequent searches should be show or not. | ||
| 1211 | * | ||
| 1212 | * plugin.tx_solr.search.frequentSearches.useLowercaseKeywords | ||
| 1213 | * | ||
| 1214 | * @param bool $defaultIfEmpty | ||
| 1215 | * @return bool | ||
| 1216 | */ | ||
| 1217 | 26 | public function getSearchFrequentSearchesUseLowercaseKeywords($defaultIfEmpty = false) | |
| 1222 | |||
| 1223 | /** | ||
| 1224 | * Returns the configuration if the search should be initialized with an empty query. | ||
| 1225 | * | ||
| 1226 | * plugin.tx_solr.search.initializeWithEmptyQuery | ||
| 1227 | * | ||
| 1228 | * @param bool $defaultIfEmpty | ||
| 1229 | * @return bool | ||
| 1230 | */ | ||
| 1231 | 32 | public function getSearchInitializeWithEmptyQuery($defaultIfEmpty = false) | |
| 1236 | |||
| 1237 | /** | ||
| 1238 | * Returns the configured initial query | ||
| 1239 | * | ||
| 1240 | * plugin.tx_solr.search.initializeWithQuery | ||
| 1241 | * | ||
| 1242 | * @param string $defaultIfEmpty | ||
| 1243 | * @return string | ||
| 1244 | */ | ||
| 1245 | 32 | public function getSearchInitializeWithQuery($defaultIfEmpty = '') | |
| 1250 | |||
| 1251 | /** | ||
| 1252 | * Returns if the last searches should be displayed or not. | ||
| 1253 | * | ||
| 1254 | * plugin.tx_solr.search.lastSearches | ||
| 1255 | * | ||
| 1256 | * @param bool $defaultIfEmpty | ||
| 1257 | * @return bool | ||
| 1258 | */ | ||
| 1259 | 24 | public function getSearchLastSearches($defaultIfEmpty = false) | |
| 1260 |     { | ||
| 1261 | 24 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.lastSearches', $defaultIfEmpty); | |
| 1262 | 24 | return $this->getBool($result); | |
| 1263 | } | ||
| 1264 | |||
| 1265 | /** | ||
| 1266 | * Returns the lastSearch mode. "user" for user specific | ||
| 1267 | * | ||
| 1268 | * plugin.tx_solr.search.lastSearches.mode | ||
| 1269 | * | ||
| 1270 | * @param string $defaultIfEmpty | ||
| 1271 | * @return string | ||
| 1272 | */ | ||
| 1273 | 28 | public function getSearchLastSearchesMode($defaultIfEmpty = 'user') | |
| 1278 | |||
| 1279 | /** | ||
| 1280 | * Returns the lastSearch limit | ||
| 1281 | * | ||
| 1282 | * plugin.tx_solr.search.lastSearches.limit | ||
| 1283 | * | ||
| 1284 | * @param int $defaultIfEmpty | ||
| 1285 | * @return int | ||
| 1286 | */ | ||
| 1287 | 28 | public function getSearchLastSearchesLimit($defaultIfEmpty = 10) | |
| 1292 | |||
| 1293 | /** | ||
| 1294 | * Indicates if the results of an initial empty query should be shown or not. | ||
| 1295 | * | ||
| 1296 | * plugin.tx_solr.search.showResultsOfInitialEmptyQuery | ||
| 1297 | * | ||
| 1298 | * @param bool $defaultIfEmpty | ||
| 1299 | * @return bool | ||
| 1300 | */ | ||
| 1301 | 7 | public function getSearchShowResultsOfInitialEmptyQuery($defaultIfEmpty = false) | |
| 1302 |     { | ||
| 1303 | 7 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.showResultsOfInitialEmptyQuery', $defaultIfEmpty); | |
| 1304 | 7 | return $this->getBool($result); | |
| 1305 | } | ||
| 1306 | |||
| 1307 | /** | ||
| 1308 | * Indicates if the results of an initial search query should be shown. | ||
| 1309 | * | ||
| 1310 | * plugin.tx_solr.search.showResultsOfInitialQuery | ||
| 1311 | * | ||
| 1312 | * @param bool $defaultIfEmpty | ||
| 1313 | * @return bool | ||
| 1314 | */ | ||
| 1315 | 5 | public function getSearchShowResultsOfInitialQuery($defaultIfEmpty = false) | |
| 1320 | |||
| 1321 | /** | ||
| 1322 | * Indicates if sorting was enabled or not. | ||
| 1323 | * | ||
| 1324 | * plugin.tx_solr.search.sorting | ||
| 1325 | * | ||
| 1326 | * @param bool $defaultIfEmpty | ||
| 1327 | * @return bool | ||
| 1328 | */ | ||
| 1329 | 57 | public function getSearchSorting($defaultIfEmpty = false) | |
| 1334 | |||
| 1335 | /** | ||
| 1336 | * Returns the sorting options configurations. | ||
| 1337 | * | ||
| 1338 | * plugin.tx_solr.search.sorting.options. | ||
| 1339 | * | ||
| 1340 | * @param array $defaultIfEmpty | ||
| 1341 | * @return array | ||
| 1342 | */ | ||
| 1343 | 28 | public function getSearchSortingOptionsConfiguration($defaultIfEmpty = []) | |
| 1348 | |||
| 1349 | /** | ||
| 1350 | * Retrieves the sorting default order for a sort option. | ||
| 1351 | * | ||
| 1352 | * plugin.tx_solr.search.sorting.options.<sortOptionName>.defaultOrder | ||
| 1353 | * | ||
| 1354 | * or | ||
| 1355 | * | ||
| 1356 | * plugin.tx_solr.search.sorting.defaultOrder | ||
| 1357 | * | ||
| 1358 | * | ||
| 1359 | * @param string $sortOptionName | ||
| 1360 | * @param string $defaultIfEmpty | ||
| 1361 | * @return string | ||
| 1362 | */ | ||
| 1363 | 31 | public function getSearchSortingDefaultOrderBySortOptionName($sortOptionName = '', $defaultIfEmpty = 'asc') | |
| 1364 |     { | ||
| 1365 | 31 | $sortOrderSpecificPath = 'plugin.tx_solr.search.sorting.options.' . $sortOptionName . '.defaultOrder'; | |
| 1366 | 31 | $specificSortOrder = $this->getValueByPathOrDefaultValue($sortOrderSpecificPath, null); | |
| 1367 | |||
| 1368 | // if we have a concrete setting, use it | ||
| 1369 | 31 |         if ($specificSortOrder !== null) { | |
| 1370 | 2 | return strtolower($specificSortOrder); | |
| 1371 | } | ||
| 1372 | |||
| 1373 | // no specific setting, check common setting | ||
| 1374 | 29 | $commonPath = 'plugin.tx_solr.search.sorting.defaultOrder'; | |
| 1375 | 29 | $commonATagParamOrDefaultValue = $this->getValueByPathOrDefaultValue($commonPath, $defaultIfEmpty); | |
| 1376 | 29 | return strtolower($commonATagParamOrDefaultValue); | |
| 1377 | } | ||
| 1378 | |||
| 1379 | /** | ||
| 1380 | * Returns the configured fixedOrder, if nothing configured defaultIfEmpty will be returned. | ||
| 1381 | * | ||
| 1382 | * plugin.tx_solr.search.sorting.options.<sortOptionName>.fixedOrder | ||
| 1383 | * | ||
| 1384 | * @param string $sortOptionName | ||
| 1385 | * @param string $defaultIfEmpty | ||
| 1386 | * @return string | ||
| 1387 | */ | ||
| 1388 | public function getSearchSortingFixedOrderBySortOptionName($sortOptionName = '', $defaultIfEmpty = '') | ||
| 1389 |     { | ||
| 1390 | $fixedOrder = 'plugin.tx_solr.search.sorting.options.' . $sortOptionName . '.fixedOrder'; | ||
| 1391 | return strtolower($this->getValueByPathOrDefaultValue($fixedOrder, $defaultIfEmpty)); | ||
| 1392 | } | ||
| 1393 | |||
| 1394 | /** | ||
| 1395 | * Returns the trusted fields configured for the search that do not need to be escaped. | ||
| 1396 | * | ||
| 1397 | * @param array $defaultIfEmpty | ||
| 1398 | * @return array | ||
| 1399 | */ | ||
| 1400 | 3 | public function getSearchTrustedFieldsArray($defaultIfEmpty = ['url']) | |
| 1401 |     { | ||
| 1402 | 3 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.trustedFields', ''); | |
| 1403 | |||
| 1404 | 3 |         if (trim($result) === '') { | |
| 1405 | return $defaultIfEmpty; | ||
| 1406 | } | ||
| 1407 | |||
| 1408 | 3 |         return GeneralUtility::trimExplode(',', $result); | |
| 1409 | } | ||
| 1410 | |||
| 1411 | /** | ||
| 1412 | * Indicates if the plugin arguments should be kept in the search form for a second submission. | ||
| 1413 | * | ||
| 1414 | * plugin.tx_solr.search.keepExistingParametersForNewSearches | ||
| 1415 | * | ||
| 1416 | * @param bool $defaultIfEmpty | ||
| 1417 | * @return bool | ||
| 1418 | */ | ||
| 1419 | public function getSearchKeepExistingParametersForNewSearches($defaultIfEmpty = false) | ||
| 1420 |     { | ||
| 1421 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.keepExistingParametersForNewSearches', $defaultIfEmpty); | ||
| 1422 | return $this->getBool($result); | ||
| 1423 | } | ||
| 1424 | |||
| 1425 | /** | ||
| 1426 | * Returns if an empty query is allowed on the query level. | ||
| 1427 | * | ||
| 1428 | * plugin.tx_solr.search.query.allowEmptyQuery | ||
| 1429 | * | ||
| 1430 | * @param string $defaultIfEmpty | ||
| 1431 | * @return bool | ||
| 1432 | */ | ||
| 1433 | 27 | public function getSearchQueryAllowEmptyQuery($defaultIfEmpty = '') | |
| 1434 |     { | ||
| 1435 | 27 |         $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.query.allowEmptyQuery', $defaultIfEmpty); | |
| 1436 | 27 | return $this->getBool($result); | |
| 1437 | } | ||
| 1438 | |||
| 1439 | /** | ||
| 1440 | * Returns the filter configuration array | ||
| 1441 | * | ||
| 1442 | * plugin.tx_solr.search.query.filter. | ||
| 1443 | * | ||
| 1444 | * @param array $defaultIfEmpty | ||
| 1445 | * @return array | ||
| 1446 | */ | ||
| 1447 | 39 | public function getSearchQueryFilterConfiguration(array $defaultIfEmpty = []) | |
| 1452 | |||
| 1453 | /** | ||
| 1454 | * Can be used to overwrite the filterConfiguration. | ||
| 1455 | * | ||
| 1456 | * plugin.tx_solr.search.query.filter. | ||
| 1457 | * | ||
| 1458 | * @param array $configuration | ||
| 1459 | */ | ||
| 1460 | 1 | public function setSearchQueryFilterConfiguration(array $configuration) | |
| 1461 |     { | ||
| 1462 | 1 |         $this->configurationAccess->set('plugin.tx_solr.search.query.filter.', $configuration); | |
| 1463 | 1 | } | |
| 1464 | |||
| 1465 | /** | ||
| 1466 | * Removes the pageSections filter setting. | ||
| 1467 | * | ||
| 1468 | * @return void | ||
| 1469 | */ | ||
| 1470 | 2 | public function removeSearchQueryFilterForPageSections() | |
| 1471 |     { | ||
| 1472 | 2 |         $this->configurationAccess->reset('plugin.tx_solr.search.query.filter.__pageSections'); | |
| 1473 | 2 | } | |
| 1474 | |||
| 1475 | /** | ||
| 1476 | * Returns the configured queryFields from TypoScript | ||
| 1477 | * | ||
| 1478 | * plugin.tx_solr.search.query.queryFields | ||
| 1479 | * | ||
| 1480 | * @param string $defaultIfEmpty | ||
| 1481 | * @return string | ||
| 1482 | */ | ||
| 1483 | 121 | public function getSearchQueryQueryFields($defaultIfEmpty = '') | |
| 1487 | |||
| 1488 | /** | ||
| 1489 | * Returns the configured returnFields as array. | ||
| 1490 | * | ||
| 1491 | * plugin.tx_solr.search.query.returnFields | ||
| 1492 | * | ||
| 1493 | * @param array $defaultIfEmpty | ||
| 1494 | * @return array | ||
| 1495 | */ | ||
| 1496 | 123 | public function getSearchQueryReturnFieldsAsArray($defaultIfEmpty = []) | |
| 1505 | |||
| 1506 | /** | ||
| 1507 | * Returns the configured target page for the search. | ||
| 1508 | * By default the contextPageId will be used | ||
| 1509 | * | ||
| 1510 | * plugin.tx_solr.search.targetPage | ||
| 1511 | * | ||
| 1512 | * @return int | ||
| 1513 | */ | ||
| 1514 | 127 | public function getSearchTargetPage() | |
| 1524 | |||
| 1525 | /** | ||
| 1526 | * Retrieves the targetPage configuration. | ||
| 1527 | * | ||
| 1528 | * plugin.tx_solr.search.targetPage. | ||
| 1529 | * | ||
| 1530 | * @param array $defaultIfEmpty | ||
| 1531 | * @return array | ||
| 1532 | */ | ||
| 1533 | public function getSearchTargetPageConfiguration(array $defaultIfEmpty = []) | ||
| 1538 | |||
| 1539 | /** | ||
| 1540 | * Method to check if the site highlighting is enabled. When the siteHighlighting is enabled the | ||
| 1541 | * sword_list parameter is added to the results link. | ||
| 1542 | * | ||
| 1543 | * plugin.tx_solr.searcb.results.siteHighlighting | ||
| 1544 | * | ||
| 1545 | * @param bool $defaultIfEmpty | ||
| 1546 | * @return bool | ||
| 1547 | */ | ||
| 1548 | 21 | public function getSearchResultsSiteHighlighting($defaultIfEmpty = true) | |
| 1553 | |||
| 1554 | |||
| 1555 | /** | ||
| 1556 | * Can be used to check if the highlighting is enabled | ||
| 1557 | * | ||
| 1558 | * plugin.tx_solr.search.results.resultsHighlighting | ||
| 1559 | * | ||
| 1560 | * @param boolean $defaultIfEmpty | ||
| 1561 | * @return string | ||
| 1562 | */ | ||
| 1563 | 121 | public function getSearchResultsHighlighting($defaultIfEmpty = false) | |
| 1568 | |||
| 1569 | /** | ||
| 1570 | * Returns the result highlighting fields. | ||
| 1571 | * | ||
| 1572 | * plugin.tx_solr.search.results.resultsHighlighting.highlightFields | ||
| 1573 | * | ||
| 1574 | * @param string $defaultIfEmpty | ||
| 1575 | * @return string | ||
| 1576 | */ | ||
| 1577 | 36 | public function getSearchResultsHighlightingFields($defaultIfEmpty = '') | |
| 1581 | |||
| 1582 | /** | ||
| 1583 | * Returns the result highlighting fields as array. | ||
| 1584 | * | ||
| 1585 | * plugin.tx_solr.search.results.resultsHighlighting.highlightFields | ||
| 1586 | * | ||
| 1587 | * @param array $defaultIfEmpty | ||
| 1588 | * @return array | ||
| 1589 | */ | ||
| 1590 | public function getSearchResultsHighlightingFieldsAsArray($defaultIfEmpty = []) | ||
| 1600 | |||
| 1601 | /** | ||
| 1602 | * Returns the fragmentSize for highlighted segments. | ||
| 1603 | * | ||
| 1604 | * plugin.tx_solr.search.results.resultsHighlighting.fragmentSize | ||
| 1605 | * | ||
| 1606 | * @param int $defaultIfEmpty | ||
| 1607 | * @return int | ||
| 1608 | */ | ||
| 1609 | 36 | public function getSearchResultsHighlightingFragmentSize($defaultIfEmpty = 200) | |
| 1613 | |||
| 1614 | /** | ||
| 1615 | * Returns the fragmentSeparator for highlighted segments. | ||
| 1616 | * | ||
| 1617 | * plugin.tx_solr.search.results.resultsHighlighting.fragmentSeparator | ||
| 1618 | * | ||
| 1619 | * @param string $defaultIfEmpty | ||
| 1620 | * @return string | ||
| 1621 | */ | ||
| 1622 | 21 | public function getSearchResultsHighlightingFragmentSeparator($defaultIfEmpty = '[...]') | |
| 1626 | |||
| 1627 | /** | ||
| 1628 | * Returns the number of results that should be shown per page. | ||
| 1629 | * | ||
| 1630 | * plugin.tx_solr.search.results.resultsPerPage | ||
| 1631 | * | ||
| 1632 | * @param int $defaultIfEmpty | ||
| 1633 | * @return int | ||
| 1634 | */ | ||
| 1635 | 30 | public function getSearchResultsPerPage($defaultIfEmpty = 10) | |
| 1639 | |||
| 1640 | /** | ||
| 1641 | * Returns the available options for the per page switch. | ||
| 1642 | * | ||
| 1643 | * plugin.tx_solr.search.results.resultsPerPageSwitchOptions | ||
| 1644 | * | ||
| 1645 | * @param array $defaultIfEmpty | ||
| 1646 | * @return array | ||
| 1647 | */ | ||
| 1648 | 30 | public function getSearchResultsPerPageSwitchOptionsAsArray($defaultIfEmpty = []) | |
| 1658 | |||
| 1659 | /** | ||
| 1660 | * Returns the configured wrap for the resultHighlighting. | ||
| 1661 | * | ||
| 1662 | * plugin.tx_solr.search.results.resultsHighlighting.wrap | ||
| 1663 | * | ||
| 1664 | * @param string $defaultIfEmpty | ||
| 1665 | * @return string | ||
| 1666 | */ | ||
| 1667 | 36 | public function getSearchResultsHighlightingWrap($defaultIfEmpty = '') | |
| 1671 | |||
| 1672 | /** | ||
| 1673 | * Indicates if spellchecking is enabled or not. | ||
| 1674 | * | ||
| 1675 | * plugin.tx_solr.search.spellchecking | ||
| 1676 | * | ||
| 1677 | * @param bool $defaultIfEmpty | ||
| 1678 | * @return bool | ||
| 1679 | */ | ||
| 1680 | public function getSearchSpellchecking($defaultIfEmpty = false) | ||
| 1685 | |||
| 1686 | /** | ||
| 1687 | * Returns the wrap that should be used for spellchecking | ||
| 1688 | * | ||
| 1689 | * plugin.tx_solr.search.spellchecking.wrap | ||
| 1690 | * | ||
| 1691 | * @param string $defaultIfEmpty | ||
| 1692 | * @return string | ||
| 1693 | */ | ||
| 1694 | public function getSearchSpellcheckingWrap($defaultIfEmpty = '') | ||
| 1698 | |||
| 1699 | /** | ||
| 1700 | * Returns the numberOfSuggestionsToTry that should be used for the spellchecking. | ||
| 1701 | * | ||
| 1702 | * plugin.tx_solr.search.spellchecking.numberOfSuggestionsToTry | ||
| 1703 | * | ||
| 1704 | * @param int $defaultIfEmpty | ||
| 1705 | * @return int | ||
| 1706 | */ | ||
| 1707 | 28 | public function getSearchSpellcheckingNumberOfSuggestionsToTry($defaultIfEmpty = 0) | |
| 1711 | |||
| 1712 | /** | ||
| 1713 | * Indicates if a second search should be fired from the spellchecking suggestion if no results could be found. | ||
| 1714 | * | ||
| 1715 | * plugin.tx_solr.search.spellchecking.searchUsingSpellCheckerSuggestion | ||
| 1716 | * | ||
| 1717 | * @param bool $defaultIfEmpty | ||
| 1718 | * @return bool | ||
| 1719 | */ | ||
| 1720 | public function getSearchSpellcheckingSearchUsingSpellCheckerSuggestion($defaultIfEmpty = false) | ||
| 1725 | |||
| 1726 | /** | ||
| 1727 | * Indicates if faceting is enabled or not. | ||
| 1728 | * | ||
| 1729 | * plugin.tx_solr.search.faceting | ||
| 1730 | * | ||
| 1731 | * @param bool $defaultIfEmpty | ||
| 1732 | * @return bool | ||
| 1733 | */ | ||
| 1734 | 121 | public function getSearchFaceting($defaultIfEmpty = false) | |
| 1739 | |||
| 1740 | /** | ||
| 1741 | * Retrieves the showEvenWhenEmpty for a facet by facet name. If nothing specific is configured | ||
| 1742 | * the global showEmptyFacets with be returned. | ||
| 1743 | * | ||
| 1744 | * plugin.tx_solr.search.faceting.facets.<facetName>.showEvenWhenEmpty | ||
| 1745 | * | ||
| 1746 | * or | ||
| 1747 | * | ||
| 1748 | * plugin.tx_solr.search.faceting.showEmptyFacets | ||
| 1749 | * | ||
| 1750 | * | ||
| 1751 | * @param string $facetName | ||
| 1752 | * @param bool $defaultIfEmpty | ||
| 1753 | * @return bool | ||
| 1754 | */ | ||
| 1755 | 59 | public function getSearchFacetingShowEmptyFacetsByName($facetName = '', $defaultIfEmpty = false) | |
| 1770 | |||
| 1771 | /** | ||
| 1772 | * Returns the wrap for the faceting show all link | ||
| 1773 | * | ||
| 1774 | * plugin.tx_solr.search.faceting.showAllLink.wrap | ||
| 1775 | * | ||
| 1776 | * @param string $defaultIfEmpty | ||
| 1777 | * @return string | ||
| 1778 | */ | ||
| 1779 | public function getSearchFacetingShowAllLinkWrap($defaultIfEmpty = '') | ||
| 1783 | |||
| 1784 | /** | ||
| 1785 | * Returns the link url parameters that should be added to a facet. | ||
| 1786 | * | ||
| 1787 | * plugin.tx_solr.search.faceting.facetLinkUrlParameters | ||
| 1788 | * | ||
| 1789 | * @param string $defaultIfEmpty | ||
| 1790 | * @return string | ||
| 1791 | */ | ||
| 1792 | 23 | public function getSearchFacetingFacetLinkUrlParameters($defaultIfEmpty = '') | |
| 1798 | |||
| 1799 | /** | ||
| 1800 | * Returns if the facetLinkUrlsParameters should be included in the reset link. | ||
| 1801 | * | ||
| 1802 | * plugin.tx_solr.search.faceting.facetLinkUrlParameters.useForFacetResetLinkUrl | ||
| 1803 | * | ||
| 1804 | * @param bool $defaultIfEmpty | ||
| 1805 | * @return bool | ||
| 1806 | */ | ||
| 1807 | 2 | public function getSearchFacetingFacetLinkUrlParametersUseForFacetResetLinkUrl($defaultIfEmpty = true) | |
| 1812 | |||
| 1813 | /** | ||
| 1814 | * Returns the link url parameters that should be added to a facet as array. | ||
| 1815 | * | ||
| 1816 | * plugin.tx_solr.search.faceting.facetLinkUrlParameters | ||
| 1817 | * | ||
| 1818 | * @param array $defaultIfEmpty | ||
| 1819 | * @return array | ||
| 1820 | */ | ||
| 1821 | 23 | public function getSearchFacetingFacetLinkUrlParametersAsArray($defaultIfEmpty = []) | |
| 1830 | |||
| 1831 | /** | ||
| 1832 | * Return the configured minimumCount value for facets. | ||
| 1833 | * | ||
| 1834 | * plugin.tx_solr.search.faceting.minimumCount | ||
| 1835 | * | ||
| 1836 | * @param int $defaultIfEmpty | ||
| 1837 | * @return int | ||
| 1838 | */ | ||
| 1839 | 36 | public function getSearchFacetingMinimumCount($defaultIfEmpty = 1) | |
| 1843 | |||
| 1844 | /** | ||
| 1845 | * Return the configured limit value for facets, used for displaying. | ||
| 1846 | * | ||
| 1847 | * plugin.tx_solr.search.faceting.limit | ||
| 1848 | * | ||
| 1849 | * @param int $defaultIfEmpty | ||
| 1850 | * @return int | ||
| 1851 | */ | ||
| 1852 | public function getSearchFacetingLimit($defaultIfEmpty = 10) | ||
| 1856 | |||
| 1857 | /** | ||
| 1858 | * Return the configured limit value for facets, used for the response. | ||
| 1859 | * | ||
| 1860 | * plugin.tx_solr.search.faceting.facetLimit | ||
| 1861 | * | ||
| 1862 | * @param int $defaultIfEmpty | ||
| 1863 | * @return int | ||
| 1864 | */ | ||
| 1865 | 36 | public function getSearchFacetingFacetLimit($defaultIfEmpty = 100) | |
| 1869 | |||
| 1870 | /** | ||
| 1871 | * Returns if the singleFacetMode is active or not. | ||
| 1872 | * | ||
| 1873 | * plugin.tx_solr.search.faceting.singleFacetMode | ||
| 1874 | * | ||
| 1875 | * @param bool $defaultIfEmpty | ||
| 1876 | * @return bool | ||
| 1877 | */ | ||
| 1878 | public function getSearchFacetingSingleFacetMode($defaultIfEmpty = false) | ||
| 1883 | |||
| 1884 | /** | ||
| 1885 | * Return the configured faceting sortBy value. | ||
| 1886 | * | ||
| 1887 | * plugin.tx_solr.search.faceting.sortBy | ||
| 1888 | * | ||
| 1889 | * @param string $defaultIfEmpty | ||
| 1890 | * @return string | ||
| 1891 | */ | ||
| 1892 | 36 | public function getSearchFacetingSortBy($defaultIfEmpty = '') | |
| 1896 | |||
| 1897 | /** | ||
| 1898 | * Returns if a facets should be kept on selection. Global faceting setting | ||
| 1899 | * can also be configured on facet level by using | ||
| 1900 | * (plugin.tx_solr.search.faceting.facets.<fieldName>.keepAllOptionsOnSelection) | ||
| 1901 | * | ||
| 1902 | * plugin.tx_solr.search.faceting.keepAllFacetsOnSelection | ||
| 1903 | * | ||
| 1904 | * @param bool $defaultIfEmpty | ||
| 1905 | * @return bool | ||
| 1906 | */ | ||
| 1907 | 33 | public function getSearchFacetingKeepAllFacetsOnSelection($defaultIfEmpty = false) | |
| 1912 | |||
| 1913 | /** | ||
| 1914 | * Returns the configured faceting configuration. | ||
| 1915 | * | ||
| 1916 | * plugin.tx_solr.search.faceting.facets | ||
| 1917 | * | ||
| 1918 | * @param array $defaultIfEmpty | ||
| 1919 | * @return array | ||
| 1920 | */ | ||
| 1921 | 60 | public function getSearchFacetingFacets(array $defaultIfEmpty = []) | |
| 1925 | |||
| 1926 | /** | ||
| 1927 | * Returns the configuration of a single facet by facet name. | ||
| 1928 | * | ||
| 1929 | * plugin.tx_solr.search.faceting.facets.<facetName> | ||
| 1930 | * | ||
| 1931 | * @param string $facetName | ||
| 1932 | * @param array $defaultIfEmpty | ||
| 1933 | * @return array | ||
| 1934 | */ | ||
| 1935 | 33 | public function getSearchFacetingFacetByName($facetName, $defaultIfEmpty = []) | |
| 1939 | |||
| 1940 | /** | ||
| 1941 | * Indicates if statistics is enabled or not. | ||
| 1942 | * | ||
| 1943 | * plugin.tx_solr.statistics | ||
| 1944 | * | ||
| 1945 | * @param bool $defaultIfEmpty | ||
| 1946 | * @return bool | ||
| 1947 | */ | ||
| 1948 | 31 | public function getStatistics($defaultIfEmpty = false) | |
| 1953 | |||
| 1954 | /** | ||
| 1955 | * Indicates to which length an ip should be anonymized in the statistics | ||
| 1956 | * | ||
| 1957 | * plugin.tx_solr.statistics.anonymizeIP | ||
| 1958 | * | ||
| 1959 | * @param int $defaultIfEmpty | ||
| 1960 | * @return int | ||
| 1961 | */ | ||
| 1962 | 22 | public function getStatisticsAnonymizeIP($defaultIfEmpty = 0) | |
| 1967 | |||
| 1968 | /** | ||
| 1969 | * Indicates if additional debug Data should be added to the statistics | ||
| 1970 | * | ||
| 1971 | * plugin.tx_solr.statistics.addDebugData | ||
| 1972 | * | ||
| 1973 | * @param bool $defaultIfEmpty | ||
| 1974 | * @return bool | ||
| 1975 | */ | ||
| 1976 | 27 | public function getStatisticsAddDebugData($defaultIfEmpty = false) | |
| 1981 | |||
| 1982 | /** | ||
| 1983 | * Indicates if suggestion is enabled or not. | ||
| 1984 | * | ||
| 1985 | * plugin.tx_solr.suggest | ||
| 1986 | * | ||
| 1987 | * @param bool $defaultIfEmpty | ||
| 1988 | * @return bool | ||
| 1989 | */ | ||
| 1990 | public function getSuggest($defaultIfEmpty = false) | ||
| 1995 | |||
| 1996 | /** | ||
| 1997 | * Indicates if https should be used for the suggest form. | ||
| 1998 | * | ||
| 1999 | * plugin.tx_solr.suggest.forceHttps | ||
| 2000 | * | ||
| 2001 | * @param bool $defaultIfEmpty | ||
| 2002 | * @return bool | ||
| 2003 | */ | ||
| 2004 | public function getSuggestForceHttps($defaultIfEmpty = false) | ||
| 2009 | |||
| 2010 | /** | ||
| 2011 | * Returns the configured template for a specific template fileKey. | ||
| 2012 | * | ||
| 2013 | * plugin.tx_solr.search.templateFiles.<fileKey> | ||
| 2014 | * | ||
| 2015 | * @param string $fileKey | ||
| 2016 | * @param string $defaultIfEmpty | ||
| 2017 | * @return string | ||
| 2018 | */ | ||
| 2019 | 33 | public function getTemplateByFileKey($fileKey, $defaultIfEmpty = '') | |
| 2024 | |||
| 2025 | /** | ||
| 2026 | * Returns the configuration of the crop view helper. | ||
| 2027 | * | ||
| 2028 | * plugin.tx_solr.viewHelpers.crop. | ||
| 2029 | * | ||
| 2030 | * @param array $defaultIfEmpty | ||
| 2031 | * @return array | ||
| 2032 | */ | ||
| 2033 | public function getViewHelpersCropConfiguration(array $defaultIfEmpty = []) | ||
| 2038 | |||
| 2039 | /** | ||
| 2040 | * Returns the configuration of the sorting view helper. | ||
| 2041 | * | ||
| 2042 | * plugin.tx_solr.viewHelpers.sortIndicator. | ||
| 2043 | * | ||
| 2044 | * @param array $defaultIfEmpty | ||
| 2045 | * @return array | ||
| 2046 | */ | ||
| 2047 | public function getViewHelpersSortIndicatorConfiguration(array $defaultIfEmpty = []) | ||
| 2052 | |||
| 2053 | /** | ||
| 2054 | * Controls whether ext-solr will send commits to solr. | ||
| 2055 | * Beware: If you disable this, you need to ensure | ||
| 2056 | * that some other mechanism will commit your changes | ||
| 2057 | * otherwise they will never be searchable. | ||
| 2058 | * A good way to achieve this is enabling the solr | ||
| 2059 | * daemons autoCommit feature. | ||
| 2060 | * | ||
| 2061 | * plugin.tx_solr.index.enableCommits | ||
| 2062 | * | ||
| 2063 | * @param bool $defaultIfEmpty | ||
| 2064 | * @return bool | ||
| 2065 | */ | ||
| 2066 | 16 | public function getEnableCommits($defaultIfEmpty = true) | |
| 2071 | |||
| 2072 | /** | ||
| 2073 | * Returns the url namespace that is used for the arguments. | ||
| 2074 | * | ||
| 2075 | * plugin.tx_solr.view.pluginNamespace | ||
| 2076 | * | ||
| 2077 | * @param string $defaultIfEmpty | ||
| 2078 | * @return string | ||
| 2079 | */ | ||
| 2080 | 35 | public function getSearchPluginNamespace($defaultIfEmpty = 'tx_solr') | |
| 2084 | |||
| 2085 | /** | ||
| 2086 | * Returns true if the global url parameter q, that indicates the query should be used. | ||
| 2087 | * | ||
| 2088 | * Should be set to false, when multiple instance on the same page should have their querystring. | ||
| 2089 | * | ||
| 2090 | * plugin.tx_solr.search.ignoreGlobalQParameter | ||
| 2091 | * | ||
| 2092 | * @param bool $defaultIfEmpty | ||
| 2093 | * @return bool | ||
| 2094 | */ | ||
| 2095 | 22 | public function getSearchIgnoreGlobalQParameter($defaultIfEmpty = false) | |
| 2101 | |||
| 2102 | /** | ||
| 2103 | * Method to check if grouping was enabled with typoscript. | ||
| 2104 | * | ||
| 2105 | * plugin.tx_solr.search.grouping | ||
| 2106 | * | ||
| 2107 | * @param bool $defaultIfEmpty | ||
| 2108 | * @return bool | ||
| 2109 | */ | ||
| 2110 | 123 | public function getSearchGrouping($defaultIfEmpty = false) | |
| 2115 | |||
| 2116 | /** | ||
| 2117 | * Returns the configured numberOfGroups. | ||
| 2118 | * | ||
| 2119 | * plugin.tx_solr.search.grouping.numberOfGroups | ||
| 2120 | * | ||
| 2121 | * @param int $defaultIfEmpty | ||
| 2122 | * @return int | ||
| 2123 | */ | ||
| 2124 | public function getSearchGroupingNumberOfGroups($defaultIfEmpty = 5) | ||
| 2128 | |||
| 2129 | /** | ||
| 2130 | * Returns the highestValue of the numberOfResultsPerGroup configuration that is globally configured and | ||
| 2131 | * for each group. | ||
| 2132 | * | ||
| 2133 | * plugin.tx_solr.search.grouping. | ||
| 2134 | * | ||
| 2135 | * @param int $defaultIfEmpty | ||
| 2136 | * @return int | ||
| 2137 | */ | ||
| 2138 | 2 | public function getSearchGroupingHighestGroupResultsLimit($defaultIfEmpty = 1) | |
| 2159 | |||
| 2160 | /** | ||
| 2161 | * Returns everything that is configured for the groups (plugin.tx_solr.search.grouping.groups.) | ||
| 2162 | * | ||
| 2163 | * plugin.tx_solr.search.grouping.groups. | ||
| 2164 | * | ||
| 2165 | * @param array $defaultIfEmpty | ||
| 2166 | * @return array | ||
| 2167 | */ | ||
| 2168 | public function getSearchGroupingGroupsConfiguration($defaultIfEmpty = []) | ||
| 2172 | |||
| 2173 | /* | ||
| 2174 | * Applies the stdWrap if it is configured for the path, otherwise the unprocessed value will be returned. | ||
| 2175 | * | ||
| 2176 | * @param string $valuePath | ||
| 2177 | * @param mixed $value | ||
| 2178 | * @return mixed | ||
| 2179 | */ | ||
| 2180 | 7 | protected function renderContentElementOfConfigured($valuePath, $value) | |
| 2191 | } | ||
| 2192 |