Completed
Pull Request — master (#725)
by Georg
09:43
created

getIndexQueueAdditionalWhereClauseByConfigurationName()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 11
ccs 6
cts 6
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 6
nc 2
nop 1
crap 2
1
<?php
2
3
namespace ApacheSolrForTypo3\Solr\System\Configuration;
4
5
use ApacheSolrForTypo3\Solr\System\Util\ArrayAccessor;
6
use InvalidArgumentException;
7
use TYPO3\CMS\Core\Utility\ArrayUtility;
8
use TYPO3\CMS\Core\Utility\GeneralUtility;
9
10
/**
11
 * TypoScript configuration object, used to read all TypoScript configuration.
12
 *
13
 * The TypoScriptConfiguration was introduced in order to be able to replace the old,
14
 * array based configuration with one configuration object.
15
 *
16
 * To read the configuration, you should use
17
 *
18
 * $configuration->getValueByPath
19
 *
20
 * or
21
 *
22
 * $configuration->isValidPath
23
 *
24
 * to check if an configuration path exists.
25
 *
26
 * To ensure Backwards compatibility the TypoScriptConfiguration object implements the
27
 * ArrayAccess interface (offsetGet,offsetExists,offsetUnset and offsetSet)
28
 *
29
 * This was only introduced to be backwards compatible in logTerm only "getValueByPath", "isValidPath" or
30
 * speaking methods for configuration settings should be used!
31
 *
32
 * @author Marc Bastian Heinrichs <[email protected]>
33
 * @author Timo Schmidt <[email protected]>
34
 */
35
class TypoScriptConfiguration
36
{
37
38
    /**
39
     * Holds the solr configuration
40
     *
41
     * @deprecated will be removed in 6.0
42
     * @var array
43
     */
44
    protected $configuration = array();
45
46
    /**
47
     * @var \ApacheSolrForTypo3\Solr\System\Util\ArrayAccessor|null
48
     */
49
    protected $configurationAccess = null;
50
51
    /**
52
     * Holds the pageId in which context the configuration was parsed
53
     * (normally $GLOBALS['TSFE']->id)
54
     */
55
    protected $contextPageId = 0;
56
57
    /**
58
     * @param array $configuration
59
     * @param int $contextPageId
60
     */
61 173
    public function __construct(array $configuration, $contextPageId = 0)
62
    {
63 173
        $this->configuration = $configuration;
0 ignored issues
show
Deprecated Code introduced by
The property ApacheSolrForTypo3\Solr\...uration::$configuration has been deprecated with message: will be removed in 6.0

This property has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.

Loading history...
64 173
        $this->configurationAccess = new ArrayAccessor($configuration, '.', true);
65 173
        $this->contextPageId = $contextPageId;
66 173
    }
67
68
    /**
69
     * Checks if a value is 1, '1', 'true'
70
     * @param mixed $value
71
     * @return bool
72
     */
73 159
    protected function getBool($value)
74
    {
75 159
        return filter_var($value, FILTER_VALIDATE_BOOLEAN);
76
    }
77
78
    /**
79
     * This method can be used to only retrieve array keys where the value is not an array.
80
     *
81
     * This can be very handy in the configuration when only keys should ne taken into account
82
     * where the value is not a subconfiguration (typically an typoscript object path).
83
     *
84
     * @param $inputArray
85
     * @return array
86
     */
87 4
    protected function getOnlyArrayKeysWhereValueIsNotAnArray($inputArray)
88
    {
89 4
        $keysWithNonArrayValue = array();
90
91 4
        foreach ($inputArray as $key => $value) {
92 4
            if (is_array($value)) {
93
                // configuration for a content object, skipping
94 3
                continue;
95
            }
96
97 4
            $keysWithNonArrayValue[] = $key;
98
        }
99
100 4
        return $keysWithNonArrayValue;
101
    }
102
103
    /**
104
     * Gets the value from a given TypoScript path.
105
     *
106
     * In the context of an frontend content element the path plugin.tx_solr is
107
     * merged recursive with overrule with the content element specific typoscript
108
     * settings, like plugin.tx_solr_PiResults_Results, and possible flex form settings
109
     * (depends on the solr plugin).
110
     *
111
     * Example: plugin.tx_solr.search.targetPage
112
     * returns $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_solr.']['search.']['targetPage']
113
     *
114
     * @param string $path TypoScript path
115
     * @return array The TypoScript object defined by the given path
116
     * @throws InvalidArgumentException
117
     */
118 190
    public function getValueByPath($path)
119
    {
120 190
        if (!is_string($path)) {
121
            throw new InvalidArgumentException('Parameter $path is not a string',
122
                1325623321);
123
        }
124
125 190
        return $this->configurationAccess->get($path);
126
    }
127
128
    /**
129
     * This method can be used to get  a configuration value by path if it exists or return a
130
     * default value when it does not exist.
131
     *
132
     * @param string $path
133
     * @param mixed $defaultValue
134
     * @return mixed
135
     */
136 189
    public function getValueByPathOrDefaultValue($path, $defaultValue)
137
    {
138 189
        $value = $this->getValueByPath($path);
139 189
        if (is_null($value)) {
140 174
            return $defaultValue;
141
        }
142
143 86
        return $value;
144
    }
145
146
    /**
147
     * Gets the parent TypoScript Object from a given TypoScript path.
148
     *
149
     * In the context of an frontend content element the path plugin.tx_solr is
150
     * merged recursive with overrule with the content element specific typoscript
151
     * settings, like plugin.tx_solr_PiResults_Results, and possible flex form settings
152
     * (depends on the solr plugin).
153
     *
154
     * Example: plugin.tx_solr.index.queue.tt_news.fields.content
155
     * returns $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_solr.']['index.']['queue.']['tt_news.']['fields.']['content.']
156
     * which is a SOLR_CONTENT cObj.
157
     *
158
     * @param string $path TypoScript path
159
     * @return array The TypoScript object defined by the given path
160
     * @throws InvalidArgumentException
161
     */
162 88
    public function getObjectByPath($path)
163
    {
164 88
        if (substr($path, -1) !== '.') {
165 4
            $path = rtrim($path, '.');
166 4
            $path = substr($path, 0, strrpos($path, '.') + 1);
167
        }
168
169 88
        if (!is_string($path)) {
170
            throw new InvalidArgumentException('Parameter $path is not a string', 1325627243);
171
        }
172
173 88
        return $this->configurationAccess->get($path);
174
    }
175
176
    /**
177
     * Gets the parent TypoScript Object from a given TypoScript path and if not present return
178
     * the default value
179
     *
180
     * @see getObjectByPath
181
     * @param string $path
182
     * @param array $defaultValue
183
     * @return array
184
     */
185 84
    public function getObjectByPathOrDefault($path, array $defaultValue)
186
    {
187
        try {
188 84
            $object = $this->getObjectByPath($path);
189
        } catch (\InvalidArgumentException $e) {
190
            return $defaultValue;
191
        }
192
193 84
        if (!is_array($object)) {
194 41
            return $defaultValue;
195
        }
196
197 73
        return $object;
198
    }
199
200
    /**
201
     * Checks whether a given TypoScript path is valid.
202
     *
203
     * @param string $path TypoScript path
204
     * @return bool TRUE if the path resolves, FALSE otherwise
205
     */
206
    public function isValidPath($path)
207
    {
208
        $isValidPath = false;
209
210
        $pathValue = $this->getValueByPath($path);
211
        if (!is_null($pathValue)) {
212
            $isValidPath = true;
213
        }
214
215
        return $isValidPath;
216
    }
217
218
    /**
219
     * Merges a configuration with another configuration a
220
     *
221
     * @param array $configurationToMerge
222
     * @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.
223
     * @param bool $includeEmptyValues If set, values from $overrule will overrule if they are empty or zero.
224
     * @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.
225
     * @return TypoScriptConfiguration
226
     */
227 26
    public function mergeSolrConfiguration(array $configurationToMerge, $addKeys = true, $includeEmptyValues = true, $enableUnsetFeature = true)
228
    {
229 26
        $data = $this->configurationAccess->getData();
230 26
        ArrayUtility::mergeRecursiveWithOverrule(
231 26
            $data['plugin.']['tx_solr.'],
232
            $configurationToMerge,
233
            $addKeys,
234
            $includeEmptyValues,
235
            $enableUnsetFeature
236
        );
237
238 26
        $this->configurationAccess->setData($data);
239
240 26
        return $this;
241
    }
242
243
    /**
244
     * Returns the configured css file for a specific fileKey.
245
     *
246
     * plugin.tx_solr.cssFiles.<fileKey>
247
     *
248
     * @param string $fileKey
249
     * @param string $defaultIfEmpty
250
     * @return string
251
     */
252 25
    public function getCssFileByFileKey($fileKey, $defaultIfEmpty = '')
253
    {
254 25
        $cssFileName = $this->getValueByPathOrDefaultValue('plugin.tx_solr.cssFiles.' . $fileKey, $defaultIfEmpty);
255 25
        return (string)$cssFileName;
256
    }
257
258
    /**
259
     * Returns the configured additionalFields configured for the indexing.
260
     *
261
     * plugin.tx_solr.index.additionalFields.
262
     *
263
     * @param array $defaultIfEmpty
264
     * @return array
265
     */
266 3
    public function getIndexAdditionalFieldsConfiguration($defaultIfEmpty = array())
267
    {
268 3
        $result = $this->getObjectByPathOrDefault('plugin.tx_solr.index.additionalFields.', $defaultIfEmpty);
269 3
        return $result;
270
    }
271
272
    /**
273
     * Returns all solr fields names where a mapping is configured in index.additionalFields
274
     *
275
     * Returns all keys from
276
     * plugin.tx_solr.index.additionalFields.
277
     *
278
     * @param array $defaultIfEmpty
279
     * @return array
280
     */
281 2
    public function getIndexMappedAdditionalFieldNames($defaultIfEmpty = array())
282
    {
283 2
        $mappingConfiguration = $this->getIndexAdditionalFieldsConfiguration();
284 2
        $mappedFieldNames = $this->getOnlyArrayKeysWhereValueIsNotAnArray($mappingConfiguration);
285 2
        return count($mappedFieldNames) == 0 ? $defaultIfEmpty : $mappedFieldNames;
286
    }
287
288
    /**
289
     * Returns the fieldProcessingInstructions configuration array
290
     *
291
     * plugin.tx_solr.index.fieldProcessingInstructions.
292
     *
293
     * @param array $defaultIfEmpty
294
     * @return array
295
     */
296 42
    public function getIndexFieldProcessingInstructionsConfiguration(array $defaultIfEmpty = array())
297
    {
298 42
        $result = $this->getObjectByPathOrDefault('plugin.tx_solr.index.fieldProcessingInstructions.', $defaultIfEmpty);
299 42
        return $result;
300
    }
301
302
    /**
303
     * Retrieves the indexing configuration array for an indexing queue by configuration name.
304
     *
305
     * plugin.tx_solr.index.queue.<configurationName>.
306
     *
307
     * @param string $configurationName
308
     * @param array $defaultIfEmpty
309
     * @return array
310
     */
311 3
    public function getIndexQueueConfigurationByName($configurationName, array $defaultIfEmpty = array())
312
    {
313 3
        $path = 'plugin.tx_solr.index.queue.' . $configurationName . '.';
314 3
        $result = $this->getObjectByPathOrDefault($path, $defaultIfEmpty);
315 3
        return $result;
316
    }
317
318
    /**
319
     * Returns an array of all allowedPageTypes.
320
     *
321
     * plugin.tx_solr.index.queue.pages.allowedPageTypes
322
     *
323
     * @param array $defaultIfEmpty
324
     * @return array
325
     */
326 10
    public function getIndexQueuePagesAllowedPageTypesArray($defaultIfEmpty = array())
327
    {
328 10
        $path = 'plugin.tx_solr.index.queue.pages.allowedPageTypes';
329 10
        $result = $this->getValueByPathOrDefaultValue($path, '');
330
331 10
        if (trim($result) == '') {
332
            return $defaultIfEmpty;
333
        }
334
335 10
        return GeneralUtility::trimExplode(',', $result);
336
    }
337
338
    /**
339
     * Returns the configured excludeContentByClass patterns as array.
340
     *
341
     * plugin.tx_solr.index.queue.pages.excludeContentByClass
342
     *
343
     * @param array $defaultIfEmpty
344
     * @return array
345
     */
346 30
    public function getIndexQueuePagesExcludeContentByClassArray($defaultIfEmpty = array())
347
    {
348 30
        $path = 'plugin.tx_solr.index.queue.pages.excludeContentByClass';
349 30
        $result = $this->getValueByPathOrDefaultValue($path, '');
350
351 30
        if (trim($result) == '') {
352
            return $defaultIfEmpty;
353
        }
354
355 30
        return GeneralUtility::trimExplode(',', $result);
356
    }
357
358
    /**
359
     * Returns the configured database table for an indexing queue configuration or
360
     * the configurationName itself that is used by convention as tableName when no
361
     * other tablename is present.
362
     *
363
     * plugin.tx_solr.index.queue.<configurationName>.table or configurationName
364
     *
365
     * @param string $configurationName
366
     * @return string
367
     */
368 12
    public function getIndexQueueTableNameOrFallbackToConfigurationName($configurationName = '')
369
    {
370 12
        $path = 'plugin.tx_solr.index.queue.' . $configurationName . '.table';
371 12
        $result = $this->getValueByPathOrDefaultValue($path, $configurationName);
372 12
        return $result;
373
    }
374
375
    /**
376
     * Returns the field configuration for a specific index queue.
377
     *
378
     * plugin.tx_solr.index.queue.<configurationName>.fields.
379
     *
380
     * @param string $configurationName
381
     * @param array $defaultIfEmpty
382
     * @return array
383
     */
384 14
    public function getIndexQueueFieldsConfigurationByConfigurationName($configurationName = '', $defaultIfEmpty = array())
385
    {
386 14
        $path = 'plugin.tx_solr.index.queue.' . $configurationName . '.fields.';
387 14
        $result = $this->getObjectByPathOrDefault($path, $defaultIfEmpty);
388 14
        return $result;
389
    }
390
391
    /**
392
     * Gets an array of tables configured for indexing by the Index Queue. Since the
393
     * record monitor must watch these tables for manipulation.
394
     *
395
     * @return array Array of table names to be watched by the record monitor.
396
     */
397 7
    public function getIndexQueueMonitoredTables()
398
    {
399 7
        $monitoredTables = [];
400
401 7
        $indexingConfigurations =  $this->getEnabledIndexQueueConfigurationNames();
402 7
        foreach ($indexingConfigurations as $indexingConfigurationName) {
403 7
            $monitoredTable = $this->getIndexQueueTableNameOrFallbackToConfigurationName($indexingConfigurationName);
404 7
            $monitoredTables[] = $monitoredTable;
405 7
            if ($monitoredTable == 'pages') {
406
                // when monitoring pages, also monitor creation of translations
407 7
                $monitoredTables[] = 'pages_language_overlay';
408
            }
409
        }
410
411 7
        return array_values(array_unique($monitoredTables));
412
    }
413
414
    /**
415
     * This method can be used to check if a table is configured to be monitored by the record monitor.
416
     *
417
     * @param string $tableName
418
     * @return boolean
419
     */
420 6
    public function getIndexQueueIsMonitoredTable($tableName)
421
    {
422 6
        return in_array($tableName, $this->getIndexQueueMonitoredTables(), true);
423
    }
424
425
    /**
426
     * Returns the configured indexer class that should be used for a certain indexingConfiguration.
427
     * By default "ApacheSolrForTypo3\\Solr\\IndexQueue\\Indexer" will be returned.
428
     *
429
     * plugin.tx_solr.index.queue.<configurationName>.indexer
430
     *
431
     * @param string $configurationName
432
     * @param string $defaultIfEmpty
433
     * @return string
434
     */
435 6
    public function getIndexQueueIndexerByConfigurationName($configurationName, $defaultIfEmpty = 'ApacheSolrForTypo3\\Solr\\IndexQueue\\Indexer')
436
    {
437 6
        $path = 'plugin.tx_solr.index.queue.' . $configurationName . '.indexer';
438 6
        $result = $this->getValueByPathOrDefaultValue($path, $defaultIfEmpty);
439 6
        return $result;
440
    }
441
442
    /**
443
     * Returns the configuration of an indexer for a special indexingConfiguration. By default an empty
444
     * array is returned.
445
     *
446
     * plugin.tx_solr.index.queue.<configurationName>.indexer.
447
     *
448
     * @param string $configurationName
449
     * @param array $defaultIfEmpty
450
     * @return array
451
     */
452 6
    public function getIndexQueueIndexerConfigurationByConfigurationName($configurationName, $defaultIfEmpty = array())
453
    {
454 6
        $path = 'plugin.tx_solr.index.queue.' . $configurationName . '.indexer.';
455 6
        $result = $this->getObjectByPathOrDefault($path, $defaultIfEmpty);
456 6
        return $result;
457
    }
458
459
    /**
460
     * Returns all solr fields names where a mapping configuration is set for a certain index configuration
461
     *
462
     * Returns all keys from
463
     * plugin.tx_solr.index.queue.<configurationName>.fields.
464
     *
465
     * @param string $configurationName
466
     * @param array $defaultIfEmpty
467
     * @return array
468
     */
469 3
    public function getIndexQueueMappedFieldsByConfigurationName($configurationName = '', $defaultIfEmpty = array())
470
    {
471 3
        $mappingConfiguration = $this->getIndexQueueFieldsConfigurationByConfigurationName($configurationName);
472 3
        $mappedFieldNames = $this->getOnlyArrayKeysWhereValueIsNotAnArray($mappingConfiguration);
473 3
        return count($mappedFieldNames) == 0 ? $defaultIfEmpty : $mappedFieldNames;
474
    }
475
476
    /**
477
     * This method is used to check if an index queue configuration is enabled or not
478
     *
479
     * plugin.tx_solr.index.queue.<configurationName> = 1
480
     *
481
     * @param string $configurationName
482
     * @param bool $defaultIfEmpty
483
     * @return bool
484
     */
485 1
    public function getIndexQueueConfigurationIsEnabled($configurationName, $defaultIfEmpty = false)
486
    {
487 1
        $path = 'plugin.tx_solr.index.queue.' . $configurationName;
488 1
        $result = $this->getValueByPathOrDefaultValue($path, $defaultIfEmpty);
489 1
        return $this->getBool($result);
490
    }
491
492
    /**
493
     * Retrieves an array of enabled index queue configurations.
494
     *
495
     * plugin.tx_solr.index.queue.<configurationName>
496
     *
497
     * @param array $defaultIfEmpty
498
     * @return array
499
     */
500 9
    public function getEnabledIndexQueueConfigurationNames($defaultIfEmpty = array())
501
    {
502 9
        $tablesToIndex = array();
503 9
        $path = 'plugin.tx_solr.index.queue.';
504 9
        $indexQueueConfiguration = $this->getObjectByPathOrDefault($path, array());
505 9
        foreach ($indexQueueConfiguration as $configurationName => $indexingEnabled) {
506 9
            if (substr($configurationName, -1) != '.' && $indexingEnabled) {
507 9
                $tablesToIndex[] = $configurationName;
508
            }
509
        }
510
511 9
        return count($tablesToIndex) == 0 ? $defaultIfEmpty : $tablesToIndex;
512
    }
513
514
    /**
515
     * Retrieves and additional where clause when configured or an empty string.
516
     *
517
     * plugin.tx_solr.index.queue.<configurationName>.additionalWhereClause
518
     *
519
     * @param string $configurationName
520
     * @return string
521
     */
522 20
    public function getIndexQueueAdditionalWhereClauseByConfigurationName($configurationName)
523
    {
524 20
        $path = 'plugin.tx_solr.index.queue.' . $configurationName . '.additionalWhereClause';
525 20
        $additionalWhere = $this->getValueByPathOrDefaultValue($path, '');
526
527 20
        if (trim($additionalWhere) == '') {
528 11
            return '';
529
        }
530
531 10
        return ' AND ' . $additionalWhere;
532
    }
533
534
    /**
535
     * This method can be used to retrieve all index queue configuration names, where
536
     * a certain table is used. It can be configured with the property "table" or is using the configuration
537
     * key a fallback for the table name.
538
     *
539
     * plugin.tx_solr.index.queue.<configurationName>.
540
     *
541
     * @param string $tableName
542
     * @param array $defaultIfEmpty
543
     * @return array
544
     */
545 18
    public function getIndexQueueConfigurationNamesByTableName($tableName, $defaultIfEmpty = array())
546
    {
547 18
        $path = 'plugin.tx_solr.index.queue.';
548 18
        $configuration = $this->getObjectByPathOrDefault($path, array());
549 18
        $possibleConfigurations = array();
550
551 18
        foreach ($configuration as $configurationName => $indexingEnabled) {
552 18
            $isObject = substr($configurationName, -1) == '.';
553 18
            if ($isObject || !$indexingEnabled) {
554 18
                continue;
555
            }
556
557
            // when the configuration name equals the tableName we have a fallback
558 18
            $hasTableNameAsConfigurationName = $configurationName == $tableName;
559 18
            $hasTableAssignedInQueueConfiguration = isset($configuration[$configurationName . '.']['table']) &&
560 18
                                                    $configuration[$configurationName . '.']['table'] == $tableName;
561 18
            if ($hasTableNameAsConfigurationName || $hasTableAssignedInQueueConfiguration) {
562 18
                $possibleConfigurations[] = $configurationName;
563
            }
564
        }
565
566 18
        return count($possibleConfigurations) > 0 ? $possibleConfigurations : $defaultIfEmpty;
567
    }
568
569
    /**
570
     * This method is used to retrieve the className of a queue initializer for a certain indexing configuration
571
     * of returns the default initializer class, when noting is configured.
572
     *
573
     * plugin.tx_solr.index.queue.<configurationName>.initialization
574
     *
575
     * @param string $configurationName
576
     * @param string $defaultIfEmpty
577
     * @return mixed
578
     */
579 3
    public function getIndexQueueInitializerClassByConfigurationName($configurationName, $defaultIfEmpty = 'ApacheSolrForTypo3\\Solr\\IndexQueue\\Initializer\\Record')
580
    {
581 3
        $path = 'plugin.tx_solr.index.queue.' . $configurationName . '.initialization';
582 3
        $className = $this->getValueByPathOrDefaultValue($path, $defaultIfEmpty);
583
584 3
        return $className;
585
    }
586
587
    /**
588
     * Returns the configured javascript file for a specific fileKey.
589
     *
590
     * plugin.tx_solr.javascriptFiles.<fileKey>
591
     *
592
     * @param string $fileKey
593
     * @param string $defaultIfEmpty
594
     * @return string
595
     */
596 26
    public function getJavaScriptFileByFileKey($fileKey, $defaultIfEmpty = '')
597
    {
598 26
        $javaScriptFileName = $this->getValueByPathOrDefaultValue('plugin.tx_solr.javascriptFiles.' . $fileKey, $defaultIfEmpty);
599 26
        return (string)$javaScriptFileName;
600
    }
601
602
    /**
603
     * Returns the configuration where to load the javascript
604
     *
605
     * plugin.tx_solr.javascriptFiles.loadIn
606
     *
607
     * @param string $defaultIfEmpty
608
     * @return string
609
     */
610 25
    public function getJavaScriptLoadIn($defaultIfEmpty = 'footer')
611
    {
612 25
        $loadIn = $this->getValueByPathOrDefaultValue('plugin.tx_solr.javascriptFiles.loadIn', $defaultIfEmpty);
613 25
        return (string)$loadIn;
614
    }
615
616
    /**
617
     * Returns the _LOCAL_LANG configuration from the TypoScript.
618
     *
619
     * plugin.tx_solr._LOCAL_LANG.
620
     *
621
     * @param array $defaultIfEmpty
622
     * @return array
623
     */
624 25
    public function getLocalLangConfiguration(array $defaultIfEmpty = array())
625
    {
626 25
        $result = $this->getObjectByPathOrDefault('plugin.tx_solr._LOCAL_LANG.', $defaultIfEmpty);
627 25
        return $result;
628
    }
629
630
    /**
631
     * When this is enabled the output of the devlog, will be printed as debug output.
632
     *
633
     * @param bool $defaultIfEmpty
634
     * @return bool
635
     */
636
    public function getLoggingDebugOutputDevlog($defaultIfEmpty = false)
637
    {
638
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.logging.debugDevlogOutput', $defaultIfEmpty);
639
        return $this->getBool($result);
640
    }
641
642
    /**
643
     * Returns if query filters should be written to the log.
644
     *
645
     * plugin.tx_solr.logging.query.filters
646
     *
647
     * @param bool $defaultIfEmpty
648
     * @return bool
649
     */
650 34
    public function getLoggingQueryFilters($defaultIfEmpty = false)
651
    {
652 34
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.logging.query.filters', $defaultIfEmpty);
653 34
        return $this->getBool($result);
654
    }
655
656
    /**
657
     * Returns if the querystring should be logged or not.
658
     *
659
     * plugin.tx_solr.logging.query.queryString
660
     *
661
     * @param bool $defaultIfEmpty
662
     * @return bool
663
     */
664 25
    public function getLoggingQueryQueryString($defaultIfEmpty = false)
665
    {
666 25
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.logging.query.queryString', $defaultIfEmpty);
667 25
        return $this->getBool($result);
668
    }
669
670
    /**
671
     * Returns if the searchWords should be logged or not.
672
     *
673
     * plugin.tx_solr.logging.query.searchWords
674
     *
675
     * @param bool $defaultIfEmpty
676
     * @return bool
677
     */
678 23
    public function getLoggingQuerySearchWords($defaultIfEmpty = false)
679
    {
680 23
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.logging.query.searchWords', $defaultIfEmpty);
681 23
        return $this->getBool($result);
682
    }
683
684
    /**
685
     * Returns if the rawGet requests should be logged or not.
686
     *
687
     * plugin.tx_solr.logging.query.rawGet
688
     *
689
     * @param bool $defaultIfEmpty
690
     * @return bool
691
     */
692 53
    public function getLoggingQueryRawGet($defaultIfEmpty = false)
693
    {
694 53
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.logging.query.rawGet', $defaultIfEmpty);
695 53
        return $this->getBool($result);
696
    }
697
698
    /**
699
     * Returns if the rawPost requests should be logged or not.
700
     *
701
     * plugin.tx_solr.logging.query.rawPost
702
     *
703
     * @param bool $defaultIfEmpty
704
     * @return bool
705
     */
706 46
    public function getLoggingQueryRawPost($defaultIfEmpty = false)
707
    {
708 46
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.logging.query.rawPost', $defaultIfEmpty);
709 46
        return $this->getBool($result);
710
    }
711
712
    /**
713
     * Returns if the rawDelete requests should be logged or not.
714
     *
715
     * plugin.tx_solr.logging.query.rawDelete
716
     *
717
     * @param bool $defaultIfEmpty
718
     * @return bool
719
     */
720
    public function getLoggingQueryRawDelete($defaultIfEmpty = false)
721
    {
722
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.logging.query.rawDelete', $defaultIfEmpty);
723
        return $this->getBool($result);
724
    }
725
726
    /**
727
     * Returns if exceptions should be logged or not.
728
     *
729
     * plugin.tx_solr.logging.exceptions
730
     *
731
     * @param bool $defaultIfEmpty
732
     * @return bool
733
     */
734
    public function getLoggingExceptions($defaultIfEmpty = true)
735
    {
736
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.logging.exceptions', $defaultIfEmpty);
737
        return $this->getBool($result);
738
    }
739
740
    /**
741
     * Returns if indexing operations should be logged or not.
742
     *
743
     * plugin.tx_solr.logging.indexing
744
     *
745
     * @param bool $defaultIfEmpty
746
     * @return bool
747
     */
748 45
    public function getLoggingIndexing($defaultIfEmpty = false)
749
    {
750 45
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.logging.indexing', $defaultIfEmpty);
751 45
        return $this->getBool($result);
752
    }
753
754
    /**
755
     * Returns if indexing queue operations should be logged or not.
756
     *
757
     * plugin.tx_solr.logging.indexing.queue
758
     *
759
     * @param bool $defaultIfEmpty
760
     * @return bool
761
     */
762 12
    public function getLoggingIndexingQueue($defaultIfEmpty = false)
763
    {
764 12
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.logging.indexing.queue', $defaultIfEmpty);
765 12
        return $this->getBool($result);
766
    }
767
768
    /**
769
     * This method can be used to check if the logging during indexing should be done.
770
     * It takes the specific configuration by indexQueueConfiguration into account or is using the
771
     * fallback when the logging is enabled on queue or indexing level.
772
     *
773
     * plugin.tx_solr.logging.indexing.queue.<indexQueueConfiguration>
774
     *
775
     * @param string $indexQueueConfiguration
776
     * @param bool $defaultIfEmpty
777
     * @return bool
778
     */
779 13
    public function getLoggingIndexingQueueOperationsByConfigurationNameWithFallBack($indexQueueConfiguration, $defaultIfEmpty = false)
780
    {
781
        // when logging is globally enabled we do not need to check the specific configuration
782 13
        if ($this->getLoggingIndexing()) {
783 1
            return true;
784
        }
785
786
        // when the logging for indexing is enabled on queue level we also do not need to check the specific configuration
787 12
        if ($this->getLoggingIndexingQueue()) {
788
            return true;
789
        }
790
791 12
        $path = 'plugin.tx_solr.logging.indexing.queue.' . $indexQueueConfiguration;
792 12
        $result = $this->getValueByPathOrDefaultValue($path, $defaultIfEmpty);
793 12
        return $this->getBool($result);
794
    }
795
796
    /**
797
     * Returns if a log message should be written when a page was indexed.
798
     *
799
     * plugin.tx_solr.logging.indexing.pageIndexed
800
801
     * @param bool $defaultIfEmpty
802
     * @return bool
803
     */
804 2
    public function getLoggingIndexingPageIndexed($defaultIfEmpty = false)
805
    {
806 2
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.logging.indexing.pageIndexed', $defaultIfEmpty);
807 2
        return $this->getBool($result);
808
    }
809
810
    /**
811
     * Returns if a log message should be written when the TYPO3 search markers are missing in the page.
812
     *
813
     * plugin.tx_solr.logging.indexing.missingTypo3SearchMarkers
814
815
     * @param bool $defaultIfEmpty
816
     * @return bool
817
     */
818 3
    public function getLoggingIndexingMissingTypo3SearchMarkers($defaultIfEmpty = true)
819
    {
820 3
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.logging.indexing.missingTypo3SearchMarkers', $defaultIfEmpty);
821 3
        return $this->getBool($result);
822
    }
823
824
    /**
825
     * Returns if the initialization of an indexqueue should be logged.
826
     *
827
     * plugin.tx_solr.logging.indexing.indexQueueInitialization
828
     *
829
     * @param bool $defaultIfEmpty
830
     * @return bool
831
     */
832 5
    public function getLoggingIndexingIndexQueueInitialization($defaultIfEmpty = false)
833
    {
834 5
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.logging.indexing.indexQueueInitialization', $defaultIfEmpty);
835 5
        return $this->getBool($result);
836
    }
837
838
    /**
839
     * Indicates if the debug mode is enabled or not.
840
     *
841
     * plugin.tx_solr.enableDebugMode
842
843
     * @param bool $defaultIfEmpty
844
     * @return bool
845
     */
846 23
    public function getEnabledDebugMode($defaultIfEmpty = false)
847
    {
848 23
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.enableDebugMode', $defaultIfEmpty);
849 23
        return $this->getBool($result);
850
    }
851
852
    /**
853
     * Retrieves the complete search configuration
854
     *
855
     * plugin.tx_solr.search.
856
     *
857
     * @param array $defaultIfEmpty
858
     * @return array
859
     */
860 23
    public function getSearchConfiguration(array $defaultIfEmpty = array())
861
    {
862 23
        $result = $this->getObjectByPathOrDefault('plugin.tx_solr.search.', $defaultIfEmpty);
863 23
        return $result;
864
    }
865
866
    /**
867
     * Indicates if elevation should be used or not
868
     *
869
     * plugin.tx_solr.search.elevation
870
     *
871
     * @param bool $defaultIfEmpty
872
     * @return bool
873
     */
874 23
    public function getSearchElevation($defaultIfEmpty = false)
875
    {
876 23
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.elevation', $defaultIfEmpty);
877 23
        return $this->getBool($result);
878
    }
879
880
    /**
881
     * Indicates if elevated results should be marked
882
     *
883
     * plugin.tx_solr.search.elevation.markElevatedResults
884
     *
885
     * @param bool $defaultIfEmpty
886
     * @return bool
887
     */
888 23
    public function getSearchElevationMarkElevatedResults($defaultIfEmpty = true)
889
    {
890 23
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.elevation.markElevatedResults', $defaultIfEmpty);
891 23
        return $this->getBool($result);
892
    }
893
894
    /**
895
     * Indicates if elevation should be forced
896
     *
897
     *plugin.tx_solr.search.elevation.forceElevation
898
     *
899
     * @param bool $defaultIfEmpty
900
     * @return bool
901
     */
902 23
    public function getSearchElevationForceElevation($defaultIfEmpty = true)
903
    {
904 23
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.elevation.forceElevation', $defaultIfEmpty);
905 23
        return $this->getBool($result);
906
    }
907
908
    /**
909
     * Indicates if collapsing on a certain field should be used to build variants or not.
910
     *
911
     * plugin.tx_solr.search.variants
912
     *
913
     * @param bool $defaultIfEmpty
914
     * @return bool
915
     */
916 126
    public function getSearchVariants($defaultIfEmpty = false)
917
    {
918 126
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.variants', $defaultIfEmpty);
919 126
        return $this->getBool($result);
920
    }
921
922
    /**
923
     * Indicates if collapsing on a certain field should be used or not
924
     *
925
     * plugin.tx_solr.search.variants.variantField
926
     *
927
     * @param string $defaultIfEmpty
928
     * @return string
929
     */
930 2
    public function getSearchVariantsField($defaultIfEmpty = 'variantId')
931
    {
932 2
        return $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.variants.variantField', $defaultIfEmpty);
933
    }
934
935
    /**
936
     * Indicates if expanding of collapsed items it activated.
937
     *
938
     * plugin.tx_solr.search.variants.expand
939
     *
940
     * @param bool $defaultIfEmpty
941
     * @return bool
942
     */
943 3
    public function getSearchVariantsExpand($defaultIfEmpty = false)
944
    {
945 3
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.variants.expand', $defaultIfEmpty);
946 3
        return $this->getBool($result);
947
    }
948
949
    /**
950
     * Retrieves the number of elements that should be expanded.
951
     *
952
     * plugin.tx_solr.search.variants.limit
953
     *
954
     * @param int $defaultIfEmpty
955
     * @return int
956
     */
957 1
    public function getSearchVariantsLimit($defaultIfEmpty = 10)
958
    {
959 1
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.variants.limit', $defaultIfEmpty);
960 1
        return (int)$result;
961
    }
962
963
    /**
964
     * Indicates if frequent searches should be show or not.
965
     *
966
     * plugin.tx_solr.search.frequentSearches
967
     *
968
     * @param bool $defaultIfEmpty
969
     * @return bool
970
     */
971 23
    public function getSearchFrequentSearches($defaultIfEmpty = false)
972
    {
973 23
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.frequentSearches', $defaultIfEmpty);
974 23
        return $this->getBool($result);
975
    }
976
977
    /**
978
     * Returns the sub configuration of the frequentSearches
979
     *
980
     * plugin.tx_solr.search.frequentSearches.
981
     *
982
     * @param array $defaultIfEmpty
983
     * @return array
984
     */
985 23
    public function getSearchFrequentSearchesConfiguration($defaultIfEmpty = array())
986
    {
987 23
        $result = $this->getObjectByPathOrDefault('plugin.tx_solr.search.frequentSearches.', $defaultIfEmpty);
988 23
        return $result;
989
    }
990
991
    /**
992
     * Retrieves the minimum font size that should be used for the frequentSearches.
993
     *
994
     * plugin.tx_solr.search.frequentSearches.minSize
995
     *
996
     * @param int $defaultIfEmpty
997
     * @return int
998
     */
999
    public function getSearchFrequentSearchesMinSize($defaultIfEmpty = 14)
1000
    {
1001
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.frequentSearches.minSize', $defaultIfEmpty);
1002
        return (int)$result;
1003
    }
1004
1005
    /**
1006
     * Retrieves the maximum font size that should be used for the frequentSearches.
1007
     *
1008
     * plugin.tx_solr.search.frequentSearches.minSize
1009
     *
1010
     * @param int $defaultIfEmpty
1011
     * @return int
1012
     */
1013
    public function getSearchFrequentSearchesMaxSize($defaultIfEmpty = 32)
1014
    {
1015
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.frequentSearches.maxSize', $defaultIfEmpty);
1016
        return (int)$result;
1017
    }
1018
1019
    /**
1020
     * Indicates if frequent searches should be show or not.
1021
     *
1022
     * plugin.tx_solr.search.frequentSearches.useLowercaseKeywords
1023
     *
1024
     * @param bool $defaultIfEmpty
1025
     * @return bool
1026
     */
1027 18
    public function getSearchFrequentSearchesUseLowercaseKeywords($defaultIfEmpty = false)
1028
    {
1029 18
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.frequentSearches.useLowercaseKeywords', $defaultIfEmpty);
1030 18
        return $this->getBool($result);
1031
    }
1032
1033
    /**
1034
     * Returns the configuration if the search should be initialized with an empty query.
1035
     *
1036
     * plugin.tx_solr.search.initializeWithEmptyQuery
1037
     *
1038
     * @param bool $defaultIfEmpty
1039
     * @return bool
1040
     */
1041 25
    public function getSearchInitializeWithEmptyQuery($defaultIfEmpty = false)
1042
    {
1043 25
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.initializeWithEmptyQuery', $defaultIfEmpty);
1044 25
        return $this->getBool($result);
1045
    }
1046
1047
    /**
1048
     * Returns the configured initial query
1049
     *
1050
     * plugin.tx_solr.search.initializeWithQuery
1051
     *
1052
     * @param string $defaultIfEmpty
1053
     * @return string
1054
     */
1055 25
    public function getSearchInitializeWithQuery($defaultIfEmpty = '')
1056
    {
1057 25
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.initializeWithQuery', $defaultIfEmpty);
1058 25
        return (string)$result;
1059
    }
1060
1061
    /**
1062
     * Returns if the last searches should be displayed or not.
1063
     *
1064
     * plugin.tx_solr.search.lastSearches
1065
     *
1066
     * @param bool $defaultIfEmpty
1067
     * @return bool
1068
     */
1069 23
    public function getSearchLastSearches($defaultIfEmpty = false)
1070
    {
1071 23
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.lastSearches', $defaultIfEmpty);
1072 23
        return $this->getBool($result);
1073
    }
1074
1075
    /**
1076
     * Returns the lastSearch mode. "user" for user specific
1077
     *
1078
     * plugin.tx_solr.search.lastSearches.mode
1079
     *
1080
     * @param string $defaultIfEmpty
1081
     * @return string
1082
     */
1083 23
    public function getSearchLastSearchesMode($defaultIfEmpty = 'user')
1084
    {
1085 23
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.lastSearches.mode', $defaultIfEmpty);
1086 23
        return (string)$result;
1087
    }
1088
1089
    /**
1090
     * Returns the lastSearch limit
1091
     *
1092
     * plugin.tx_solr.search.lastSearches.limit
1093
     *
1094
     * @param int $defaultIfEmpty
1095
     * @return int
1096
     */
1097 23
    public function getSearchLastSearchesLimit($defaultIfEmpty = 10)
1098
    {
1099 23
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.lastSearches.limit', $defaultIfEmpty);
1100 23
        return (int)$result;
1101
    }
1102
1103
    /**
1104
     * Returns the search results fieldProcessingInstructions configuration array
1105
     *
1106
     * plugin.tx_solr.search.results.fieldProcessingInstructions.
1107
     *
1108
     * @param array $defaultIfEmpty
1109
     * @return array
1110
     */
1111 18
    public function getSearchResultsFieldProcessingInstructionsConfiguration(array $defaultIfEmpty = array())
1112
    {
1113 18
        $result = $this->getObjectByPathOrDefault('plugin.tx_solr.search.results.fieldProcessingInstructions.', $defaultIfEmpty);
1114 18
        return $result;
1115
    }
1116
1117
    /**
1118
     * Returns the search results fieldRenderingInstructions configuration array
1119
     *
1120
     * plugin.tx_solr.search.results.fieldRenderingInstructions.
1121
     *
1122
     * @param array $defaultIfEmpty
1123
     * @return array
1124
     */
1125 18
    public function getSearchResultsFieldRenderingInstructionsConfiguration(array $defaultIfEmpty = array())
1126
    {
1127 18
        $result = $this->getObjectByPathOrDefault('plugin.tx_solr.search.results.fieldRenderingInstructions.', $defaultIfEmpty);
1128 18
        return $result;
1129
    }
1130
1131
    /**
1132
     * Indicates if the results of an initial empty query should be shown or not.
1133
     *
1134
     * plugin.tx_solr.search.showResultsOfInitialEmptyQuery
1135
     *
1136
     * @param bool $defaultIfEmpty
1137
     * @return bool
1138
     */
1139 4
    public function getSearchShowResultsOfInitialEmptyQuery($defaultIfEmpty = false)
1140
    {
1141 4
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.showResultsOfInitialEmptyQuery', $defaultIfEmpty);
1142 4
        return $this->getBool($result);
1143
    }
1144
1145
    /**
1146
     * Indicates if the results of an initial search query should be shown.
1147
     *
1148
     * plugin.tx_solr.search.showResultsOfInitialQuery
1149
     *
1150
     * @param bool $defaultIfEmpty
1151
     * @return bool
1152
     */
1153 4
    public function getSearchShowResultsOfInitialQuery($defaultIfEmpty = false)
1154
    {
1155 4
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.showResultsOfInitialQuery', $defaultIfEmpty);
1156 4
        return $this->getBool($result);
1157
    }
1158
1159
    /**
1160
     * Indicates if sorting was enabled or not.
1161
     *
1162
     * plugin.tx_solr.search.sorting
1163
     *
1164
     * @param bool $defaultIfEmpty
1165
     * @return bool
1166
     */
1167 17
    public function getSearchSorting($defaultIfEmpty = false)
1168
    {
1169 17
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.sorting', $defaultIfEmpty);
1170 17
        return $this->getBool($result);
1171
    }
1172
1173
    /**
1174
     * Returns the sorting options configurations.
1175
     *
1176
     * plugin.tx_solr.search.sorting.options.
1177
     *
1178
     * @param array $defaultIfEmpty
1179
     * @return array
1180
     */
1181 17
    public function getSearchSortingOptionsConfiguration($defaultIfEmpty = array())
1182
    {
1183 17
        $result = $this->getObjectByPathOrDefault('plugin.tx_solr.search.sorting.options.', $defaultIfEmpty);
1184 17
        return $result;
1185
    }
1186
1187
    /**
1188
     * Retrieves the sorting default order for a sort option.
1189
     *
1190
     * plugin.tx_solr.search.sorting.options.<sortOptionName>.defaultOrder
1191
     *
1192
     * or
1193
     *
1194
     * plugin.tx_solr.search.sorting.defaultOrder
1195
     *
1196
     *
1197
     * @param string $sortOptionName
1198
     * @param string $defaultIfEmpty
1199
     * @return string
1200
     */
1201 17
    public function getSearchSortingDefaultOrderBySortOptionName($sortOptionName = '', $defaultIfEmpty = 'asc')
1202
    {
1203 17
        $sortOrderSpecificPath = 'plugin.tx_solr.search.sorting.options.' . $sortOptionName . '.defaultOrder';
1204 17
        $specificSortOrder = $this->getValueByPathOrDefaultValue($sortOrderSpecificPath, null);
1205
1206
        // if we have a concrete setting, use it
1207 17
        if ($specificSortOrder !== null) {
1208
            return $specificSortOrder;
1209
        }
1210
1211
        // no specific setting, check common setting
1212 17
        $commonPath = 'plugin.tx_solr.search.sorting.defaultOrder';
1213 17
        $commonATagParamOrDefaultValue = $this->getValueByPathOrDefaultValue($commonPath, $defaultIfEmpty);
1214 17
        return $commonATagParamOrDefaultValue;
1215
    }
1216
1217
    /**
1218
     * Returns the configured fixedOrder, if nothing configured defaultIfEmpty will be returned.
1219
     *
1220
     * plugin.tx_solr.search.sorting.options.<sortOptionName>.fixedOrder
1221
     *
1222
     * @param string $sortOptionName
1223
     * @param string $defaultIfEmpty
1224
     * @return string
1225
     */
1226 17
    public function getSearchSortingFixedOrderBySortOptionName($sortOptionName = '', $defaultIfEmpty = '')
1227
    {
1228 17
        $fixedOrder = 'plugin.tx_solr.search.sorting.options.' . $sortOptionName . '.fixedOrder';
1229 17
        return $this->getValueByPathOrDefaultValue($fixedOrder, $defaultIfEmpty);
1230
    }
1231
1232
    /**
1233
     * Returns the trusted fields configured for the search that do not need to be escaped.
1234
     *
1235
     * @param array $defaultIfEmpty
1236
     * @return array
1237
     */
1238 18
    public function getSearchTrustedFieldsArray($defaultIfEmpty = array('url'))
1239
    {
1240 18
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.trustedFields', '');
1241
1242 18
        if (trim($result) === '') {
1243
            return $defaultIfEmpty;
1244
        }
1245
1246 18
        return GeneralUtility::trimExplode(',', $result);
1247
    }
1248
1249
    /**
1250
     * Indicates if the plugin arguments should be kept in the search form for a second submission.
1251
     *
1252
     * plugin.tx_solr.search.keepExistingParametersForNewSearches
1253
     *
1254
     * @param bool $defaultIfEmpty
1255
     * @return bool
1256
     */
1257 23
    public function getSearchKeepExistingParametersForNewSearches($defaultIfEmpty = false)
1258
    {
1259 23
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.keepExistingParametersForNewSearches', $defaultIfEmpty);
1260 23
        return $this->getBool($result);
1261
    }
1262
1263
    /**
1264
     * Returns if an empty query is allowed on the query level.
1265
     *
1266
     * plugin.tx_solr.search.query.allowEmptyQuery
1267
     *
1268
     * @param string $defaultIfEmpty
1269
     * @return string
1270
     */
1271 25
    public function getSearchQueryAllowEmptyQuery($defaultIfEmpty = '')
1272
    {
1273 25
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.query.allowEmptyQuery', $defaultIfEmpty);
1274 25
        return $this->getBool($result);
1275
    }
1276
1277
    /**
1278
     * Returns the fieldProcessingInstructions configuration array
1279
     *
1280
     * plugin.tx_solr.search.query.filter.
1281
     *
1282
     * @param array $defaultIfEmpty
1283
     * @return array
1284
     */
1285 31
    public function getSearchQueryFilterConfiguration(array $defaultIfEmpty = array())
1286
    {
1287 31
        $result = $this->getObjectByPathOrDefault('plugin.tx_solr.search.query.filter.', $defaultIfEmpty);
1288 31
        return $result;
1289
    }
1290
1291
    /**
1292
     * Can be used to overwrite the filterConfiguration.
1293
     *
1294
     * plugin.tx_solr.search.query.filter.
1295
     *
1296
     * @param array $configuration
1297
     */
1298 1
    public function setSearchQueryFilterConfiguration(array $configuration)
1299
    {
1300 1
        $this->configurationAccess->set('plugin.tx_solr.search.query.filter.', $configuration);
1301 1
    }
1302
1303
    /**
1304
     * Removes the pageSections filter setting.
1305
     *
1306
     * @return void
1307
     */
1308 2
    public function removeSearchQueryFilterForPageSections()
1309
    {
1310 2
        $this->configurationAccess->reset('plugin.tx_solr.search.query.filter.__pageSections');
1311 2
    }
1312
1313
    /**
1314
     * Returns the configured queryFields from TypoScript
1315
     *
1316
     * plugin.tx_solr.search.query.queryFields
1317
     *
1318
     * @param string $defaultIfEmpty
1319
     * @return string
1320
     */
1321 127
    public function getSearchQueryQueryFields($defaultIfEmpty = '')
1322
    {
1323 127
        return $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.query.queryFields', $defaultIfEmpty);
1324
    }
1325
1326
    /**
1327
     * Returns the configured returnFields as array.
1328
     *
1329
     * plugin.tx_solr.search.query.returnFields
1330
     *
1331
     * @param array $defaultIfEmpty
1332
     * @return array
1333
     */
1334 127
    public function getSearchQueryReturnFieldsAsArray($defaultIfEmpty = array())
1335
    {
1336 127
        $returnFields = $this->getValueByPath('plugin.tx_solr.search.query.returnFields');
1337 127
        if (is_null($returnFields)) {
1338 102
            return $defaultIfEmpty;
1339
        }
1340 25
        return GeneralUtility::trimExplode(',', $returnFields);
0 ignored issues
show
Documentation introduced by
$returnFields is of type array, but the function expects a string.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
1341
    }
1342
1343
    /**
1344
     * Returns the configured target page for the search.
1345
     * By default the contextPageId will be used
1346
     *
1347
     * plugin.tx_solr.search.targetPage
1348
     *
1349
     * @return int
1350
     */
1351 132
    public function getSearchTargetPage()
1352
    {
1353 132
        $targetPage = (int)$this->getValueByPathOrDefaultValue('plugin.tx_solr.search.targetPage', 0);
1354 132
        if ($targetPage === 0) {
1355
            // when no specific page was configured we use the contextPageId (which is usual $GLOBALS['TSFE']->id)
1356 122
            $targetPage = $this->contextPageId;
1357
        }
1358
1359 132
        return $targetPage;
1360
    }
1361
1362
    /**
1363
     * Retrieves the targetPage configuration.
1364
     *
1365
     * plugin.tx_solr.search.targetPage.
1366
     *
1367
     * @param array $defaultIfEmpty
1368
     * @return array
1369
     */
1370 28
    public function getSearchTargetPageConfiguration(array $defaultIfEmpty = array())
1371
    {
1372 28
        $result = $this->getObjectByPathOrDefault('plugin.tx_solr.search.targetPage.', $defaultIfEmpty);
1373 28
        return $result;
1374
    }
1375
1376
    /**
1377
     * Retrieves the pagebrowser configuration.
1378
     *
1379
     * plugin.tx_solr.search.results.pagebrowser.
1380
     *
1381
     * @param array $defaultIfEmpty
1382
     * @return array
1383
     */
1384 18
    public function getSearchResultsPageBrowserConfiguration(array $defaultIfEmpty = array())
1385
    {
1386 18
        $result = $this->getObjectByPathOrDefault('plugin.tx_solr.search.results.pagebrowser.', $defaultIfEmpty);
1387 18
        return $result;
1388
    }
1389
1390
    /**
1391
     * Returns the result highlighting fields.
1392
     *
1393
     * plugin.tx_solr.search.results.resultsHighlighting.highlightFields
1394
     *
1395
     * @param string $defaultIfEmpty
1396
     * @return string
1397
     */
1398 30
    public function getSearchResultsHighlightingFields($defaultIfEmpty = '')
1399
    {
1400 30
        return $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.results.resultsHighlighting.highlightFields', $defaultIfEmpty);
1401
    }
1402
1403
    /**
1404
     * Returns the result highlighting fields as array.
1405
     *
1406
     * plugin.tx_solr.search.results.resultsHighlighting.highlightFields
1407
     *
1408
     * @param array $defaultIfEmpty
1409
     * @return array
1410
     */
1411 18
    public function getSearchResultsHighlightingFieldsAsArray($defaultIfEmpty = array())
1412
    {
1413 18
        $highlightingFields = $this->getSearchResultsHighlightingFields('');
1414
1415 18
        if ($highlightingFields === '') {
1416
            return $defaultIfEmpty;
1417
        }
1418
1419 18
        return GeneralUtility::trimExplode(',', $highlightingFields, true);
1420
    }
1421
1422
    /**
1423
     * Returns the fragmentSeparator for highlighted segments.
1424
     *
1425
     * plugin.tx_solr.search.results.resultsHighlighting.fragmentSeparator
1426
     *
1427
     * @param string $defaultIfEmpty
1428
     * @return string
1429
     */
1430 18
    public function getSearchResultsHighlightingFragmentSeparator($defaultIfEmpty = '[...]')
1431
    {
1432 18
        return $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.results.resultsHighlighting.fragmentSeparator', $defaultIfEmpty);
1433
    }
1434
1435
    /**
1436
     * Returns the number of results that should be shown per page.
1437
     *
1438
     * plugin.tx_solr.search.results.resultsPerPage
1439
     *
1440
     * @param int $defaultIfEmpty
1441
     * @return int
1442
     */
1443 23
    public function getSearchResultsPerPage($defaultIfEmpty = 10)
1444
    {
1445 23
        return (int)$this->getValueByPathOrDefaultValue('plugin.tx_solr.search.results.resultsPerPage', $defaultIfEmpty);
1446
    }
1447
1448
    /**
1449
     * Returns the available options for the per page switch.
1450
     *
1451
     * plugin.tx_solr.search.results.resultsPerPageSwitchOptions
1452
     *
1453
     * @param array $defaultIfEmpty
1454
     * @return array
1455
     */
1456 23
    public function getSearchResultsPerPageSwitchOptionsAsArray($defaultIfEmpty = array())
1457
    {
1458 23
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.results.resultsPerPageSwitchOptions', '');
1459
1460 23
        if (trim($result) === '') {
1461
            return $defaultIfEmpty;
1462
        }
1463
1464 23
        return GeneralUtility::intExplode(',', $result, true);
1465
    }
1466
1467
    /**
1468
     * Returns the configured wrap for the resultHighlighting.
1469
     *
1470
     * plugin.tx_solr.search.results.resultsHighlighting.wrap
1471
     *
1472
     * @param string $defaultIfEmpty
1473
     * @return string
1474
     */
1475 30
    public function getSearchResultsHighlightingWrap($defaultIfEmpty = '')
1476
    {
1477 30
        return $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.results.resultsHighlighting.wrap', $defaultIfEmpty);
1478
    }
1479
1480
    /**
1481
     * Indicates if spellchecking is enabled or not.
1482
     *
1483
     * plugin.tx_solr.search.spellchecking
1484
     *
1485
     * @param bool $defaultIfEmpty
1486
     * @return bool
1487
     */
1488 25
    public function getSearchSpellchecking($defaultIfEmpty = false)
1489
    {
1490 25
        $isFacetingEnabled = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.spellchecking', $defaultIfEmpty);
1491 25
        return $this->getBool($isFacetingEnabled);
1492
    }
1493
1494
    /**
1495
     * Returns the wrap that should be used for spellchecking
1496
     *
1497
     * plugin.tx_solr.search.spellchecking.wrap
1498
     *
1499
     * @param string $defaultIfEmpty
1500
     * @return string
1501
     */
1502 5
    public function getSearchSpellcheckingWrap($defaultIfEmpty = '')
1503
    {
1504 5
        return (string)$this->getValueByPathOrDefaultValue('plugin.tx_solr.search.spellchecking.wrap', $defaultIfEmpty);
1505
    }
1506
1507
    /**
1508
     * Returns the numberOfSuggestionsToTry that should be used for the spellchecking.
1509
     *
1510
     * plugin.tx_solr.search.spellchecking.numberOfSuggestionsToTry
1511
     *
1512
     * @param int $defaultIfEmpty
1513
     * @return int
1514
     */
1515 22
    public function getSearchSpellcheckingNumberOfSuggestionsToTry($defaultIfEmpty = 0)
1516
    {
1517 22
        return (int)$this->getValueByPathOrDefaultValue('plugin.tx_solr.search.spellchecking.numberOfSuggestionsToTry', $defaultIfEmpty);
1518
    }
1519
1520
    /**
1521
     * Indicates if a second search should be fired from the spellchecking suggestion if no results could be found.
1522
     *
1523
     * plugin.tx_solr.search.spellchecking.searchUsingSpellCheckerSuggestion
1524
     *
1525
     * @param bool $defaultIfEmpty
1526
     * @return bool
1527
     */
1528 3
    public function getSearchSpellcheckingSearchUsingSpellCheckerSuggestion($defaultIfEmpty = false)
1529
    {
1530 3
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.spellchecking.searchUsingSpellCheckerSuggestion', $defaultIfEmpty);
1531 3
        return $this->getBool($result);
1532
    }
1533
1534
    /**
1535
     * Indicates if faceting is enabled or not.
1536
     *
1537
     * plugin.tx_solr.search.faceting
1538
     *
1539
     * @param bool $defaultIfEmpty
1540
     * @return bool
1541
     */
1542 20
    public function getSearchFaceting($defaultIfEmpty = false)
1543
    {
1544 20
        $isFacetingEnabled = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.faceting', $defaultIfEmpty);
1545 20
        return $this->getBool($isFacetingEnabled);
1546
    }
1547
1548
    /**
1549
     * Retrieves the facetLinkATagParams for a facet by facet name. If nothing specific is configured
1550
     * the global facetLinkATagParams with be returned.
1551
     *
1552
     * plugin.tx_solr.search.faceting.facets.<facetName>.facetLinkATagParams
1553
     *
1554
     * or
1555
     *
1556
     * plugin.tx_solr.search.faceting.facetLinkATagParams
1557
     *
1558
     *
1559
     * @param string $facetName
1560
     * @param string $defaultIfEmpty
1561
     * @return string
1562
     */
1563 19
    public function getSearchFacetingFacetLinkATagParamsByName($facetName = '', $defaultIfEmpty = '')
1564
    {
1565 19
        $facetSpecificPath = 'plugin.tx_solr.search.faceting.facets.' . $facetName . '.facetLinkATagParams';
1566 19
        $specificATagParam = $this->getValueByPathOrDefaultValue($facetSpecificPath, null);
1567
1568
            // if we have a concrete setting, use it
1569 19
        if ($specificATagParam !== null) {
1570 1
            return $specificATagParam;
1571
        }
1572
1573
            // no specific setting, check common setting
1574 19
        $commonPath = 'plugin.tx_solr.search.faceting.facetLinkATagParams';
1575 19
        $commonATagParamOrDefaultValue = $this->getValueByPathOrDefaultValue($commonPath, $defaultIfEmpty);
1576 19
        return $commonATagParamOrDefaultValue;
1577
    }
1578
1579
    /**
1580
     * Returns the test that should be used to remove a faceting link
1581
     *
1582
     * plugin.tx_solr.search.faceting.removeFacetLinkText
1583
     *
1584
     * @param string $defaultIfEmpty
1585
     * @return string
1586
     */
1587 1
    public function getSearchFacetingRemoveFacetLinkText($defaultIfEmpty = '@facetLabel: @facetText')
1588
    {
1589 1
        return (string)$this->getValueByPathOrDefaultValue('plugin.tx_solr.search.faceting.removeFacetLinkText', $defaultIfEmpty);
1590
    }
1591
1592
    /**
1593
     * Retrieves the showEvenWhenEmpty for a facet by facet name. If nothing specific is configured
1594
     * the global showEmptyFacets with be returned.
1595
     *
1596
     * plugin.tx_solr.search.faceting.facets.<facetName>.showEvenWhenEmpty
1597
     *
1598
     * or
1599
     *
1600
     * plugin.tx_solr.search.faceting.showEmptyFacets
1601
     *
1602
     *
1603
     * @param string $facetName
1604
     * @param bool $defaultIfEmpty
1605
     * @return bool
1606
     */
1607 19
    public function getSearchFacetingShowEmptyFacetsByName($facetName = '', $defaultIfEmpty = false)
1608
    {
1609 19
        $facetSpecificPath = 'plugin.tx_solr.search.faceting.facets.' . $facetName . '.showEvenWhenEmpty';
1610 19
        $specificShowWhenEmpty = $this->getValueByPathOrDefaultValue($facetSpecificPath, null);
1611
1612
        // if we have a concrete setting, use it
1613 19
        if ($specificShowWhenEmpty !== null) {
1614 1
            return $specificShowWhenEmpty;
1615
        }
1616
1617
        // no specific setting, check common setting
1618 19
        $commonPath = 'plugin.tx_solr.search.faceting.showEmptyFacets';
1619 19
        $commonIfEmptyOrDefaultValue = $this->getValueByPathOrDefaultValue($commonPath, $defaultIfEmpty);
1620 19
        return $commonIfEmptyOrDefaultValue;
1621
    }
1622
1623
    /**
1624
     * Returns the wrap for the faceting show all link
1625
     *
1626
     * plugin.tx_solr.search.faceting.showAllLink.wrap
1627
     *
1628
     * @param string $defaultIfEmpty
1629
     * @return string
1630
     */
1631
    public function getSearchFacetingShowAllLinkWrap($defaultIfEmpty = '')
1632
    {
1633
        return (string)$this->getValueByPathOrDefaultValue('plugin.tx_solr.search.faceting.showAllLink.wrap', $defaultIfEmpty);
1634
    }
1635
1636
    /**
1637
     * Returns the link url parameters that should be added to a facet.
1638
     *
1639
     * plugin.tx_solr.search.faceting.facetLinkUrlParameters
1640
     *
1641
     * @param string $defaultIfEmpty
1642
     * @return string
1643
     */
1644 18
    public function getSearchFacetingFacetLinkUrlParameters($defaultIfEmpty = '')
1645
    {
1646 18
        $linkUrlParameters = trim($this->getValueByPathOrDefaultValue('plugin.tx_solr.search.faceting.facetLinkUrlParameters', $defaultIfEmpty));
1647
1648 18
        return $linkUrlParameters;
1649
    }
1650
1651
    /**
1652
     * Returns if the facetLinkUrlsParameters should be included in the reset link.
1653
     *
1654
     * plugin.tx_solr.search.faceting.facetLinkUrlParameters.useForFacetResetLinkUrl
1655
     *
1656
     * @param bool $defaultIfEmpty
1657
     * @return bool
1658
     */
1659 18
    public function getSearchFacetingFacetLinkUrlParametersUseForFacetResetLinkUrl($defaultIfEmpty = true)
1660
    {
1661 18
        $useForFacetResetLinkUrl = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.faceting.facetLinkUrlParameters.useForFacetResetLinkUrl', $defaultIfEmpty);
1662 18
        return $this->getBool($useForFacetResetLinkUrl);
1663
    }
1664
1665
    /**
1666
     * Returns the link url parameters that should be added to a facet as array.
1667
     *
1668
     * plugin.tx_solr.search.faceting.facetLinkUrlParameters
1669
     *
1670
     * @param array $defaultIfEmpty
1671
     * @return array
1672
     */
1673 18
    public function getSearchFacetingFacetLinkUrlParametersAsArray($defaultIfEmpty = array())
1674
    {
1675 18
        $linkUrlParameters = $this->getSearchFacetingFacetLinkUrlParameters();
1676 18
        if ($linkUrlParameters === '') {
1677
            return $defaultIfEmpty;
1678
        }
1679
1680 18
        return GeneralUtility::explodeUrl2Array($linkUrlParameters);
1681
    }
1682
1683
    /**
1684
     * Return the configured minimumCount value for facets.
1685
     *
1686
     * plugin.tx_solr.search.faceting.minimumCount
1687
     *
1688
     * @param int $defaultIfEmpty
1689
     * @return int
1690
     */
1691 31
    public function getSearchFacetingMinimumCount($defaultIfEmpty = 1)
1692
    {
1693 31
        return (int)$this->getValueByPathOrDefaultValue('plugin.tx_solr.search.faceting.minimumCount', $defaultIfEmpty);
1694
    }
1695
1696
    /**
1697
     * Return the configured limit value for facets, used for displaying.
1698
     *
1699
     * plugin.tx_solr.search.faceting.limit
1700
     *
1701
     * @param int $defaultIfEmpty
1702
     * @return int
1703
     */
1704 18
    public function getSearchFacetingLimit($defaultIfEmpty = 10)
1705
    {
1706 18
        return (int)$this->getValueByPathOrDefaultValue('plugin.tx_solr.search.faceting.limit', $defaultIfEmpty);
1707
    }
1708
1709
    /**
1710
     * Return the configured limit value for facets, used for the response.
1711
     *
1712
     * plugin.tx_solr.search.faceting.facetLimit
1713
     *
1714
     * @param int $defaultIfEmpty
1715
     * @return int
1716
     */
1717 31
    public function getSearchFacetingFacetLimit($defaultIfEmpty = 100)
1718
    {
1719 31
        return (int)$this->getValueByPathOrDefaultValue('plugin.tx_solr.search.faceting.facetLimit', $defaultIfEmpty);
1720
    }
1721
1722
    /**
1723
     * Returns if the singleFacetMode is active or not.
1724
     *
1725
     * plugin.tx_solr.search.faceting.singleFacetMode
1726
     *
1727
     * @param bool $defaultIfEmpty
1728
     * @return bool
1729
     */
1730 1
    public function getSearchFacetingSingleFacetMode($defaultIfEmpty = false)
1731
    {
1732 1
        $singleFacetMode = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.faceting.singleFacetMode', $defaultIfEmpty);
1733 1
        return $this->getBool($singleFacetMode);
1734
    }
1735
1736
    /**
1737
     * Return the configured faceting sortBy value.
1738
     *
1739
     * plugin.tx_solr.search.faceting.sortBy
1740
     *
1741
     * @param string $defaultIfEmpty
1742
     * @return string
1743
     */
1744 31
    public function getSearchFacetingSortBy($defaultIfEmpty = '')
1745
    {
1746 31
        return $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.faceting.sortBy', $defaultIfEmpty);
1747
    }
1748
1749
    /**
1750
     * Returns if a facets should be kept on selection. Global faceting setting
1751
     * can also be configured on facet level by using
1752
     * (plugin.tx_solr.search.faceting.facets.<fieldName>.keepAllOptionsOnSelection)
1753
     *
1754
     * plugin.tx_solr.search.faceting.keepAllFacetsOnSelection
1755
     *
1756
     * @param bool $defaultIfEmpty
1757
     * @return bool
1758
     */
1759 27
    public function getSearchFacetingKeepAllFacetsOnSelection($defaultIfEmpty = false)
1760
    {
1761 27
        $keepAllOptionsOnSelection = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.faceting.keepAllFacetsOnSelection', $defaultIfEmpty);
1762 27
        return $this->getBool($keepAllOptionsOnSelection);
1763
    }
1764
1765
    /**
1766
     * Returns the configured faceting configuration.
1767
     *
1768
     * plugin.tx_solr.search.faceting.facets
1769
     *
1770
     * @param array $defaultIfEmpty
1771
     * @return array
1772
     */
1773 27
    public function getSearchFacetingFacets(array $defaultIfEmpty = array())
1774
    {
1775 27
        return $this->getObjectByPathOrDefault('plugin.tx_solr.search.faceting.facets.', $defaultIfEmpty);
1776
    }
1777
1778
    /**
1779
     * Returns the configuration of a single facet by facet name.
1780
     *
1781
     * plugin.tx_solr.search.faceting.facets.<facetName>
1782
     *
1783
     * @param string $facetName
1784
     * @param array $defaultIfEmpty
1785
     * @return array
1786
     */
1787 18
    public function getSearchFacetingFacetByName($facetName, $defaultIfEmpty = array())
1788
    {
1789 18
        return $this->getObjectByPathOrDefault('plugin.tx_solr.search.faceting.facets.' . $facetName . '.', $defaultIfEmpty);
1790
    }
1791
1792
    /**
1793
     * Indicates if statistics is enabled or not.
1794
     *
1795
     * plugin.tx_solr.statistics
1796
     *
1797
     * @param bool $defaultIfEmpty
1798
     * @return bool
1799
     */
1800 23
    public function getStatistics($defaultIfEmpty = false)
1801
    {
1802 23
        $isFacetingEnabled = $this->getValueByPathOrDefaultValue('plugin.tx_solr.statistics', $defaultIfEmpty);
1803 23
        return $this->getBool($isFacetingEnabled);
1804
    }
1805
1806
    /**
1807
     * Indicates to which length an ip should be anonymized in the statistics
1808
     *
1809
     * plugin.tx_solr.statistics.anonymizeIP
1810
     *
1811
     * @param int $defaultIfEmpty
1812
     * @return int
1813
     */
1814 18
    public function getStatisticsAnonymizeIP($defaultIfEmpty = 0)
1815
    {
1816 18
        $anomizeToLength = $this->getValueByPathOrDefaultValue('plugin.tx_solr.statistics.anonymizeIP', $defaultIfEmpty);
1817 18
        return (int)$anomizeToLength;
1818
    }
1819
1820
    /**
1821
     * Indicates if suggestion is enabled or not.
1822
     *
1823
     * plugin.tx_solr.suggest
1824
     *
1825
     * @param bool $defaultIfEmpty
1826
     * @return bool
1827
     */
1828 25
    public function getSuggest($defaultIfEmpty = false)
1829
    {
1830 25
        $isSuggestionEnabled = $this->getValueByPathOrDefaultValue('plugin.tx_solr.suggest', $defaultIfEmpty);
1831 25
        return $this->getBool($isSuggestionEnabled);
1832
    }
1833
1834
    /**
1835
     * Indicates if https should be used for the suggest form.
1836
     *
1837
     * plugin.tx_solr.suggest.forceHttps
1838
     *
1839
     * @param bool $defaultIfEmpty
1840
     * @return bool
1841
     */
1842 25
    public function getSuggestForceHttps($defaultIfEmpty = false)
1843
    {
1844 25
        $isHttpsForced = $this->getValueByPathOrDefaultValue('plugin.tx_solr.suggest.forceHttps', $defaultIfEmpty);
1845 25
        return $this->getBool($isHttpsForced);
1846
    }
1847
1848
    /**
1849
     * Returns the configured template for a specific template fileKey.
1850
     *
1851
     * plugin.tx_solr.search.templateFiles.<fileKey>
1852
     *
1853
     * @param string $fileKey
1854
     * @param string $defaultIfEmpty
1855
     * @return string
1856
     */
1857 25
    public function getTemplateByFileKey($fileKey, $defaultIfEmpty = '')
1858
    {
1859 25
        $templateFileName = $this->getValueByPathOrDefaultValue('plugin.tx_solr.templateFiles.' . $fileKey, $defaultIfEmpty);
1860 25
        return (string)$templateFileName;
1861
    }
1862
1863
    /**
1864
     * Returns the configuration of the crop view helper.
1865
     *
1866
     * plugin.tx_solr.viewHelpers.crop.
1867
     *
1868
     * @param array $defaultIfEmpty
1869
     * @return array
1870
     */
1871 1
    public function getViewHelpersCropConfiguration(array $defaultIfEmpty = array())
1872
    {
1873 1
        $cropViewHelperConfiguration = $this->getObjectByPathOrDefault('plugin.tx_solr.viewHelpers.crop.', $defaultIfEmpty);
1874 1
        return $cropViewHelperConfiguration;
1875
    }
1876
1877
    /**
1878
     * Returns the configuration of the sorting view helper.
1879
     *
1880
     * plugin.tx_solr.viewHelpers.sortIndicator.
1881
     *
1882
     * @param array $defaultIfEmpty
1883
     * @return array
1884
     */
1885 17
    public function getViewHelpersSortIndicatorConfiguration(array $defaultIfEmpty = array())
1886
    {
1887 17
        $sortingViewHelperConfiguration = $this->getObjectByPathOrDefault('plugin.tx_solr.viewHelpers.sortIndicator.', $defaultIfEmpty);
1888 17
        return $sortingViewHelperConfiguration;
1889
    }
1890
}
1891