Completed
Push — master ( 4ee2ae...280585 )
by Timo
34s queued 10s
created

TypoScriptConfiguration::getMonitoredTables()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 16
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 0
Metric Value
dl 0
loc 16
ccs 0
cts 0
cp 0
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 9
nc 3
nop 0
crap 12
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 171
    public function __construct(array $configuration, $contextPageId = 0)
62
    {
63 171
        $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 171
        $this->configurationAccess = new ArrayAccessor($configuration, '.', true);
65 171
        $this->contextPageId = $contextPageId;
66 171
    }
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 188
    public function getValueByPath($path)
119
    {
120 188
        if (!is_string($path)) {
121
            throw new InvalidArgumentException('Parameter $path is not a string',
122
                1325623321);
123
        }
124
125 188
        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 187
    public function getValueByPathOrDefaultValue($path, $defaultValue)
137
    {
138 187
        $value = $this->getValueByPath($path);
139 187
        if (is_null($value)) {
140 172
            return $defaultValue;
141
        }
142
143 84
        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 86
    public function getObjectByPath($path)
163
    {
164 86
        if (substr($path, -1) !== '.') {
165 4
            $path = rtrim($path, '.');
166 4
            $path = substr($path, 0, strrpos($path, '.') + 1);
167
        }
168
169 86
        if (!is_string($path)) {
170
            throw new InvalidArgumentException('Parameter $path is not a string', 1325627243);
171
        }
172
173 86
        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 82
    public function getObjectByPathOrDefault($path, array $defaultValue)
186
    {
187
        try {
188 82
            $object = $this->getObjectByPath($path);
189
        } catch (\InvalidArgumentException $e) {
190
            return $defaultValue;
191
        }
192
193 82
        if (!is_array($object)) {
194 41
            return $defaultValue;
195
        }
196
197 71
        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 10
    public function getIndexQueueTableNameOrFallbackToConfigurationName($configurationName = '')
369
    {
370 10
        $path = 'plugin.tx_solr.index.queue.' . $configurationName . '.table';
371 10
        $result = $this->getValueByPathOrDefaultValue($path, $configurationName);
372 10
        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
     * Returns the configured indexer class that should be used for a certain indexingConfiguration.
393
     * By default "ApacheSolrForTypo3\\Solr\\IndexQueue\\Indexer" will be returned.
394
     *
395
     * plugin.tx_solr.index.queue.<configurationName>.indexer
396
     *
397
     * @param string $configurationName
398
     * @param string $defaultIfEmpty
399
     * @return string
400
     */
401 6
    public function getIndexQueueIndexerByConfigurationName($configurationName, $defaultIfEmpty = 'ApacheSolrForTypo3\\Solr\\IndexQueue\\Indexer')
402
    {
403 6
        $path = 'plugin.tx_solr.index.queue.' . $configurationName . '.indexer';
404 6
        $result = $this->getValueByPathOrDefaultValue($path, $defaultIfEmpty);
405 6
        return $result;
406
    }
407
408
    /**
409
     * Returns the configuration of an indexer for a special indexingConfiguration. By default an empty
410
     * array is returned.
411
     *
412
     * plugin.tx_solr.index.queue.<configurationName>.indexer.
413
     *
414
     * @param string $configurationName
415
     * @param array $defaultIfEmpty
416
     * @return array
417
     */
418 6
    public function getIndexQueueIndexerConfigurationByConfigurationName($configurationName, $defaultIfEmpty = array())
419
    {
420 6
        $path = 'plugin.tx_solr.index.queue.' . $configurationName . '.indexer.';
421 6
        $result = $this->getObjectByPathOrDefault($path, $defaultIfEmpty);
422 6
        return $result;
423
    }
424
425
    /**
426
     * Returns all solr fields names where a mapping configuration is set for a certain index configuration
427
     *
428
     * Returns all keys from
429
     * plugin.tx_solr.index.queue.<configurationName>.fields.
430
     *
431
     * @param string $configurationName
432
     * @param array $defaultIfEmpty
433
     * @return array
434
     */
435 3
    public function getIndexQueueMappedFieldsByConfigurationName($configurationName = '', $defaultIfEmpty = array())
436
    {
437 3
        $mappingConfiguration = $this->getIndexQueueFieldsConfigurationByConfigurationName($configurationName);
438 3
        $mappedFieldNames = $this->getOnlyArrayKeysWhereValueIsNotAnArray($mappingConfiguration);
439 3
        return count($mappedFieldNames) == 0 ? $defaultIfEmpty : $mappedFieldNames;
440
    }
441
442
    /**
443
     * This method is used to check if an index queue configuration is enabled or not
444
     *
445
     * plugin.tx_solr.index.queue.<configurationName> = 1
446
     *
447
     * @param string $configurationName
448
     * @param bool $defaultIfEmpty
449
     * @return bool
450
     */
451 1
    public function getIndexQueueConfigurationIsEnabled($configurationName, $defaultIfEmpty = false)
452
    {
453 1
        $path = 'plugin.tx_solr.index.queue.' . $configurationName;
454 1
        $result = $this->getValueByPathOrDefaultValue($path, $defaultIfEmpty);
455 1
        return $this->getBool($result);
456
    }
457
458
    /**
459
     * Retrieves an array of enabled index queue configurations.
460
     *
461
     * plugin.tx_solr.index.queue.<configurationName>
462
     *
463
     * @param array $defaultIfEmpty
464
     * @return array
465
     */
466 7
    public function getEnabledIndexQueueConfigurationNames($defaultIfEmpty = array())
467
    {
468 7
        $tablesToIndex = array();
469 7
        $path = 'plugin.tx_solr.index.queue.';
470 7
        $indexQueueConfiguration = $this->getObjectByPathOrDefault($path, array());
471 7
        foreach ($indexQueueConfiguration as $configurationName => $indexingEnabled) {
472 7
            if (substr($configurationName, -1) != '.' && $indexingEnabled) {
473 7
                $tablesToIndex[] = $configurationName;
474
            }
475
        }
476
477 7
        return count($tablesToIndex) == 0 ? $defaultIfEmpty : $tablesToIndex;
478
    }
479
480
    /**
481
     * Retrieves and additional where clause when configured or an empty string.
482
     *
483
     * plugin.tx_solr.index.queue.<configurationName>.additionalWhereClause
484
     *
485
     * @param string $configurationName
486
     * @return string
487
     */
488 20
    public function getIndexQueueAdditionalWhereClauseByConfigurationName($configurationName)
489
    {
490 20
        $path = 'plugin.tx_solr.index.queue.' . $configurationName . '.additionalWhereClause';
491 20
        $additionalWhere = $this->getValueByPathOrDefaultValue($path, '');
492
493 20
        if (trim($additionalWhere) == '') {
494 11
            return '';
495
        }
496
497 10
        return ' AND ' . $additionalWhere;
498
    }
499
500
    /**
501
     * This method can be used to retrieve all index queue configuration names, where
502
     * a certain table is used. It can be configured with the property "table" or is using the configuration
503
     * key a fallback for the table name.
504
     *
505
     * plugin.tx_solr.index.queue.<configurationName>.
506
     *
507
     * @param string $tableName
508
     * @param array $defaultIfEmpty
509
     * @return array
510
     */
511 18
    public function getIndexQueueConfigurationNamesByTableName($tableName, $defaultIfEmpty = array())
512
    {
513 18
        $path = 'plugin.tx_solr.index.queue.';
514 18
        $configuration = $this->getObjectByPathOrDefault($path, array());
515 18
        $possibleConfigurations = array();
516
517 18
        foreach ($configuration as $configurationName => $indexingEnabled) {
518 18
            $isObject = substr($configurationName, -1) == '.';
519 18
            if ($isObject || !$indexingEnabled) {
520 18
                continue;
521
            }
522
523
            // when the configuration name equals the tableName we have a fallback
524 18
            $hasTableNameAsConfigurationName = $configurationName == $tableName;
525 18
            $hasTableAssignedInQueueConfiguration = isset($configuration[$configurationName . '.']['table']) &&
526 18
                                                    $configuration[$configurationName . '.']['table'] == $tableName;
527 18
            if ($hasTableNameAsConfigurationName || $hasTableAssignedInQueueConfiguration) {
528 18
                $possibleConfigurations[] = $configurationName;
529
            }
530
        }
531
532 18
        return count($possibleConfigurations) > 0 ? $possibleConfigurations : $defaultIfEmpty;
533
    }
534
535
    /**
536
     * This method is used to retrieve the className of a queue initializer for a certain indexing configuration
537
     * of returns the default initializer class, when noting is configured.
538
     *
539
     * plugin.tx_solr.index.queue.<configurationName>.initialization
540
     *
541
     * @param string $configurationName
542
     * @param string $defaultIfEmpty
543
     * @return mixed
544
     */
545 3
    public function getIndexQueueInitializerClassByConfigurationName($configurationName, $defaultIfEmpty = 'ApacheSolrForTypo3\\Solr\\IndexQueue\\Initializer\\Record')
546
    {
547 3
        $path = 'plugin.tx_solr.index.queue.' . $configurationName . '.initialization';
548 3
        $className = $this->getValueByPathOrDefaultValue($path, $defaultIfEmpty);
549
550 3
        return $className;
551
    }
552
553
    /**
554
     * Returns the configured javascript file for a specific fileKey.
555
     *
556
     * plugin.tx_solr.javascriptFiles.<fileKey>
557
     *
558
     * @param string $fileKey
559
     * @param string $defaultIfEmpty
560
     * @return string
561
     */
562 26
    public function getJavaScriptFileByFileKey($fileKey, $defaultIfEmpty = '')
563
    {
564 26
        $javaScriptFileName = $this->getValueByPathOrDefaultValue('plugin.tx_solr.javascriptFiles.' . $fileKey, $defaultIfEmpty);
565 26
        return (string)$javaScriptFileName;
566
    }
567
568
    /**
569
     * Returns the configuration where to load the javascript
570
     *
571
     * plugin.tx_solr.javascriptFiles.loadIn
572
     *
573
     * @param string $defaultIfEmpty
574
     * @return string
575
     */
576 25
    public function getJavaScriptLoadIn($defaultIfEmpty = 'footer')
577
    {
578 25
        $loadIn = $this->getValueByPathOrDefaultValue('plugin.tx_solr.javascriptFiles.loadIn', $defaultIfEmpty);
579 25
        return (string)$loadIn;
580
    }
581
582
    /**
583
     * Returns the _LOCAL_LANG configuration from the TypoScript.
584
     *
585
     * plugin.tx_solr._LOCAL_LANG.
586
     *
587
     * @param array $defaultIfEmpty
588
     * @return array
589
     */
590 25
    public function getLocalLangConfiguration(array $defaultIfEmpty = array())
591
    {
592 25
        $result = $this->getObjectByPathOrDefault('plugin.tx_solr._LOCAL_LANG.', $defaultIfEmpty);
593 25
        return $result;
594
    }
595
596
    /**
597
     * When this is enabled the output of the devlog, will be printed as debug output.
598
     *
599
     * @param bool $defaultIfEmpty
600
     * @return bool
601
     */
602
    public function getLoggingDebugOutputDevlog($defaultIfEmpty = false)
603
    {
604
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.logging.debugDevlogOutput', $defaultIfEmpty);
605
        return $this->getBool($result);
606
    }
607
608
    /**
609
     * Returns if query filters should be written to the log.
610
     *
611
     * plugin.tx_solr.logging.query.filters
612
     *
613
     * @param bool $defaultIfEmpty
614
     * @return bool
615
     */
616 34
    public function getLoggingQueryFilters($defaultIfEmpty = false)
617
    {
618 34
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.logging.query.filters', $defaultIfEmpty);
619 34
        return $this->getBool($result);
620
    }
621
622
    /**
623
     * Returns if the querystring should be logged or not.
624
     *
625
     * plugin.tx_solr.logging.query.queryString
626
     *
627
     * @param bool $defaultIfEmpty
628
     * @return bool
629
     */
630 25
    public function getLoggingQueryQueryString($defaultIfEmpty = false)
631
    {
632 25
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.logging.query.queryString', $defaultIfEmpty);
633 25
        return $this->getBool($result);
634
    }
635
636
    /**
637
     * Returns if the searchWords should be logged or not.
638
     *
639
     * plugin.tx_solr.logging.query.searchWords
640
     *
641
     * @param bool $defaultIfEmpty
642
     * @return bool
643
     */
644 23
    public function getLoggingQuerySearchWords($defaultIfEmpty = false)
645
    {
646 23
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.logging.query.searchWords', $defaultIfEmpty);
647 23
        return $this->getBool($result);
648
    }
649
650
    /**
651
     * Returns if the rawGet requests should be logged or not.
652
     *
653
     * plugin.tx_solr.logging.query.rawGet
654
     *
655
     * @param bool $defaultIfEmpty
656
     * @return bool
657
     */
658 53
    public function getLoggingQueryRawGet($defaultIfEmpty = false)
659
    {
660 53
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.logging.query.rawGet', $defaultIfEmpty);
661 53
        return $this->getBool($result);
662
    }
663
664
    /**
665
     * Returns if the rawPost requests should be logged or not.
666
     *
667
     * plugin.tx_solr.logging.query.rawPost
668
     *
669
     * @param bool $defaultIfEmpty
670
     * @return bool
671
     */
672 46
    public function getLoggingQueryRawPost($defaultIfEmpty = false)
673
    {
674 46
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.logging.query.rawPost', $defaultIfEmpty);
675 46
        return $this->getBool($result);
676
    }
677
678
    /**
679
     * Returns if the rawDelete requests should be logged or not.
680
     *
681
     * plugin.tx_solr.logging.query.rawDelete
682
     *
683
     * @param bool $defaultIfEmpty
684
     * @return bool
685
     */
686
    public function getLoggingQueryRawDelete($defaultIfEmpty = false)
687
    {
688
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.logging.query.rawDelete', $defaultIfEmpty);
689
        return $this->getBool($result);
690
    }
691
692
    /**
693
     * Returns if exceptions should be logged or not.
694
     *
695
     * plugin.tx_solr.logging.exceptions
696
     *
697
     * @param bool $defaultIfEmpty
698
     * @return bool
699
     */
700
    public function getLoggingExceptions($defaultIfEmpty = true)
701
    {
702
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.logging.exceptions', $defaultIfEmpty);
703
        return $this->getBool($result);
704
    }
705
706
    /**
707
     * Returns if indexing operations should be logged or not.
708
     *
709
     * plugin.tx_solr.logging.indexing
710
     *
711
     * @param bool $defaultIfEmpty
712
     * @return bool
713
     */
714 45
    public function getLoggingIndexing($defaultIfEmpty = false)
715
    {
716 45
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.logging.indexing', $defaultIfEmpty);
717 45
        return $this->getBool($result);
718
    }
719
720
    /**
721
     * Returns if indexing queue operations should be logged or not.
722
     *
723
     * plugin.tx_solr.logging.indexing.queue
724
     *
725
     * @param bool $defaultIfEmpty
726
     * @return bool
727
     */
728 12
    public function getLoggingIndexingQueue($defaultIfEmpty = false)
729
    {
730 12
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.logging.indexing.queue', $defaultIfEmpty);
731 12
        return $this->getBool($result);
732
    }
733
734
    /**
735
     * This method can be used to check if the logging during indexing should be done.
736
     * It takes the specific configuration by indexQueueConfiguration into account or is using the
737
     * fallback when the logging is enabled on queue or indexing level.
738
     *
739
     * plugin.tx_solr.logging.indexing.queue.<indexQueueConfiguration>
740
     *
741
     * @param string $indexQueueConfiguration
742
     * @param bool $defaultIfEmpty
743
     * @return bool
744
     */
745 13
    public function getLoggingIndexingQueueOperationsByConfigurationNameWithFallBack($indexQueueConfiguration, $defaultIfEmpty = false)
746
    {
747
        // when logging is globally enabled we do not need to check the specific configuration
748 13
        if ($this->getLoggingIndexing()) {
749 1
            return true;
750
        }
751
752
        // when the logging for indexing is enabled on queue level we also do not need to check the specific configuration
753 12
        if ($this->getLoggingIndexingQueue()) {
754
            return true;
755
        }
756
757 12
        $path = 'plugin.tx_solr.logging.indexing.queue.' . $indexQueueConfiguration;
758 12
        $result = $this->getValueByPathOrDefaultValue($path, $defaultIfEmpty);
759 12
        return $this->getBool($result);
760
    }
761
762
    /**
763
     * Returns if a log message should be written when a page was indexed.
764
     *
765
     * plugin.tx_solr.logging.indexing.pageIndexed
766
767
     * @param bool $defaultIfEmpty
768
     * @return bool
769
     */
770 2
    public function getLoggingIndexingPageIndexed($defaultIfEmpty = false)
771
    {
772 2
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.logging.indexing.pageIndexed', $defaultIfEmpty);
773 2
        return $this->getBool($result);
774
    }
775
776
    /**
777
     * Returns if a log message should be written when the TYPO3 search markers are missing in the page.
778
     *
779
     * plugin.tx_solr.logging.indexing.missingTypo3SearchMarkers
780
781
     * @param bool $defaultIfEmpty
782
     * @return bool
783
     */
784 3
    public function getLoggingIndexingMissingTypo3SearchMarkers($defaultIfEmpty = true)
785
    {
786 3
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.logging.indexing.missingTypo3SearchMarkers', $defaultIfEmpty);
787 3
        return $this->getBool($result);
788
    }
789
790
    /**
791
     * Returns if the initialization of an indexqueue should be logged.
792
     *
793
     * plugin.tx_solr.logging.indexing.indexQueueInitialization
794
     *
795
     * @param bool $defaultIfEmpty
796
     * @return bool
797
     */
798 5
    public function getLoggingIndexingIndexQueueInitialization($defaultIfEmpty = false)
799
    {
800 5
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.logging.indexing.indexQueueInitialization', $defaultIfEmpty);
801 5
        return $this->getBool($result);
802
    }
803
804
    /**
805
     * Indicates if the debug mode is enabled or not.
806
     *
807
     * plugin.tx_solr.enableDebugMode
808
809
     * @param bool $defaultIfEmpty
810
     * @return bool
811
     */
812 23
    public function getEnabledDebugMode($defaultIfEmpty = false)
813
    {
814 23
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.enableDebugMode', $defaultIfEmpty);
815 23
        return $this->getBool($result);
816
    }
817
818
    /**
819
     * Retrieves the complete search configuration
820
     *
821
     * plugin.tx_solr.search.
822
     *
823
     * @param array $defaultIfEmpty
824
     * @return array
825
     */
826 23
    public function getSearchConfiguration(array $defaultIfEmpty = array())
827
    {
828 23
        $result = $this->getObjectByPathOrDefault('plugin.tx_solr.search.', $defaultIfEmpty);
829 23
        return $result;
830
    }
831
832
    /**
833
     * Indicates if elevation should be used or not
834
     *
835
     * plugin.tx_solr.search.elevation
836
     *
837
     * @param bool $defaultIfEmpty
838
     * @return bool
839
     */
840 23
    public function getSearchElevation($defaultIfEmpty = false)
841
    {
842 23
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.elevation', $defaultIfEmpty);
843 23
        return $this->getBool($result);
844
    }
845
846
    /**
847
     * Indicates if elevated results should be marked
848
     *
849
     * plugin.tx_solr.search.elevation.markElevatedResults
850
     *
851
     * @param bool $defaultIfEmpty
852
     * @return bool
853
     */
854 23
    public function getSearchElevationMarkElevatedResults($defaultIfEmpty = true)
855
    {
856 23
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.elevation.markElevatedResults', $defaultIfEmpty);
857 23
        return $this->getBool($result);
858
    }
859
860
    /**
861
     * Indicates if elevation should be forced
862
     *
863
     *plugin.tx_solr.search.elevation.forceElevation
864
     *
865
     * @param bool $defaultIfEmpty
866
     * @return bool
867
     */
868 23
    public function getSearchElevationForceElevation($defaultIfEmpty = true)
869
    {
870 23
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.elevation.forceElevation', $defaultIfEmpty);
871 23
        return $this->getBool($result);
872
    }
873
874
    /**
875
     * Indicates if collapsing on a certain field should be used to build variants or not.
876
     *
877
     * plugin.tx_solr.search.variants
878
     *
879
     * @param bool $defaultIfEmpty
880
     * @return bool
881
     */
882 126
    public function getSearchVariants($defaultIfEmpty = false)
883
    {
884 126
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.variants', $defaultIfEmpty);
885 126
        return $this->getBool($result);
886
    }
887
888
    /**
889
     * Indicates if collapsing on a certain field should be used or not
890
     *
891
     * plugin.tx_solr.search.variants.variantField
892
     *
893
     * @param string $defaultIfEmpty
894
     * @return string
895
     */
896 2
    public function getSearchVariantsField($defaultIfEmpty = 'variantId')
897
    {
898 2
        return $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.variants.variantField', $defaultIfEmpty);
899
    }
900
901
    /**
902
     * Indicates if expanding of collapsed items it activated.
903
     *
904
     * plugin.tx_solr.search.variants.expand
905
     *
906
     * @param bool $defaultIfEmpty
907
     * @return bool
908
     */
909 3
    public function getSearchVariantsExpand($defaultIfEmpty = false)
910
    {
911 3
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.variants.expand', $defaultIfEmpty);
912 3
        return $this->getBool($result);
913
    }
914
915
    /**
916
     * Retrieves the number of elements that should be expanded.
917
     *
918
     * plugin.tx_solr.search.variants.limit
919
     *
920
     * @param int $defaultIfEmpty
921
     * @return int
922
     */
923 1
    public function getSearchVariantsLimit($defaultIfEmpty = 10)
924
    {
925 1
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.variants.limit', $defaultIfEmpty);
926 1
        return (int)$result;
927
    }
928
929
    /**
930
     * Indicates if frequent searches should be show or not.
931
     *
932
     * plugin.tx_solr.search.frequentSearches
933
     *
934
     * @param bool $defaultIfEmpty
935
     * @return bool
936
     */
937 23
    public function getSearchFrequentSearches($defaultIfEmpty = false)
938
    {
939 23
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.frequentSearches', $defaultIfEmpty);
940 23
        return $this->getBool($result);
941
    }
942
943
    /**
944
     * Returns the sub configuration of the frequentSearches
945
     *
946
     * plugin.tx_solr.search.frequentSearches.
947
     *
948
     * @param array $defaultIfEmpty
949
     * @return array
950
     */
951 23
    public function getSearchFrequentSearchesConfiguration($defaultIfEmpty = array())
952
    {
953 23
        $result = $this->getObjectByPathOrDefault('plugin.tx_solr.search.frequentSearches.', $defaultIfEmpty);
954 23
        return $result;
955
    }
956
957
    /**
958
     * Retrieves the minimum font size that should be used for the frequentSearches.
959
     *
960
     * plugin.tx_solr.search.frequentSearches.minSize
961
     *
962
     * @param int $defaultIfEmpty
963
     * @return int
964
     */
965
    public function getSearchFrequentSearchesMinSize($defaultIfEmpty = 14)
966
    {
967
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.frequentSearches.minSize', $defaultIfEmpty);
968
        return (int)$result;
969
    }
970
971
    /**
972
     * Retrieves the maximum font size that should be used for the frequentSearches.
973
     *
974
     * plugin.tx_solr.search.frequentSearches.minSize
975
     *
976
     * @param int $defaultIfEmpty
977
     * @return int
978
     */
979
    public function getSearchFrequentSearchesMaxSize($defaultIfEmpty = 32)
980
    {
981
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.frequentSearches.maxSize', $defaultIfEmpty);
982
        return (int)$result;
983
    }
984
985
    /**
986
     * Indicates if frequent searches should be show or not.
987
     *
988
     * plugin.tx_solr.search.frequentSearches.useLowercaseKeywords
989
     *
990
     * @param bool $defaultIfEmpty
991
     * @return bool
992
     */
993 18
    public function getSearchFrequentSearchesUseLowercaseKeywords($defaultIfEmpty = false)
994
    {
995 18
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.frequentSearches.useLowercaseKeywords', $defaultIfEmpty);
996 18
        return $this->getBool($result);
997
    }
998
999
    /**
1000
     * Returns the configuration if the search should be initialized with an empty query.
1001
     *
1002
     * plugin.tx_solr.search.initializeWithEmptyQuery
1003
     *
1004
     * @param bool $defaultIfEmpty
1005
     * @return bool
1006
     */
1007 25
    public function getSearchInitializeWithEmptyQuery($defaultIfEmpty = false)
1008
    {
1009 25
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.initializeWithEmptyQuery', $defaultIfEmpty);
1010 25
        return $this->getBool($result);
1011
    }
1012
1013
    /**
1014
     * Returns the configured initial query
1015
     *
1016
     * plugin.tx_solr.search.initializeWithQuery
1017
     *
1018
     * @param string $defaultIfEmpty
1019
     * @return string
1020
     */
1021 25
    public function getSearchInitializeWithQuery($defaultIfEmpty = '')
1022
    {
1023 25
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.initializeWithQuery', $defaultIfEmpty);
1024 25
        return (string)$result;
1025
    }
1026
1027
    /**
1028
     * Returns if the last searches should be displayed or not.
1029
     *
1030
     * plugin.tx_solr.search.lastSearches
1031
     *
1032
     * @param bool $defaultIfEmpty
1033
     * @return bool
1034
     */
1035 23
    public function getSearchLastSearches($defaultIfEmpty = false)
1036
    {
1037 23
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.lastSearches', $defaultIfEmpty);
1038 23
        return $this->getBool($result);
1039
    }
1040
1041
    /**
1042
     * Returns the lastSearch mode. "user" for user specific
1043
     *
1044
     * plugin.tx_solr.search.lastSearches.mode
1045
     *
1046
     * @param string $defaultIfEmpty
1047
     * @return string
1048
     */
1049 23
    public function getSearchLastSearchesMode($defaultIfEmpty = 'user')
1050
    {
1051 23
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.lastSearches.mode', $defaultIfEmpty);
1052 23
        return (string)$result;
1053
    }
1054
1055
    /**
1056
     * Returns the lastSearch limit
1057
     *
1058
     * plugin.tx_solr.search.lastSearches.limit
1059
     *
1060
     * @param int $defaultIfEmpty
1061
     * @return int
1062
     */
1063 23
    public function getSearchLastSearchesLimit($defaultIfEmpty = 10)
1064
    {
1065 23
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.lastSearches.limit', $defaultIfEmpty);
1066 23
        return (int)$result;
1067
    }
1068
1069
    /**
1070
     * Returns the search results fieldProcessingInstructions configuration array
1071
     *
1072
     * plugin.tx_solr.search.results.fieldProcessingInstructions.
1073
     *
1074
     * @param array $defaultIfEmpty
1075
     * @return array
1076
     */
1077 18
    public function getSearchResultsFieldProcessingInstructionsConfiguration(array $defaultIfEmpty = array())
1078
    {
1079 18
        $result = $this->getObjectByPathOrDefault('plugin.tx_solr.search.results.fieldProcessingInstructions.', $defaultIfEmpty);
1080 18
        return $result;
1081
    }
1082
1083
    /**
1084
     * Returns the search results fieldRenderingInstructions configuration array
1085
     *
1086
     * plugin.tx_solr.search.results.fieldRenderingInstructions.
1087
     *
1088
     * @param array $defaultIfEmpty
1089
     * @return array
1090
     */
1091 18
    public function getSearchResultsFieldRenderingInstructionsConfiguration(array $defaultIfEmpty = array())
1092
    {
1093 18
        $result = $this->getObjectByPathOrDefault('plugin.tx_solr.search.results.fieldRenderingInstructions.', $defaultIfEmpty);
1094 18
        return $result;
1095
    }
1096
1097
    /**
1098
     * Indicates if the results of an initial empty query should be shown or not.
1099
     *
1100
     * plugin.tx_solr.search.showResultsOfInitialEmptyQuery
1101
     *
1102
     * @param bool $defaultIfEmpty
1103
     * @return bool
1104
     */
1105 4
    public function getSearchShowResultsOfInitialEmptyQuery($defaultIfEmpty = false)
1106
    {
1107 4
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.showResultsOfInitialEmptyQuery', $defaultIfEmpty);
1108 4
        return $this->getBool($result);
1109
    }
1110
1111
    /**
1112
     * Indicates if the results of an initial search query should be shown.
1113
     *
1114
     * plugin.tx_solr.search.showResultsOfInitialQuery
1115
     *
1116
     * @param bool $defaultIfEmpty
1117
     * @return bool
1118
     */
1119 4
    public function getSearchShowResultsOfInitialQuery($defaultIfEmpty = false)
1120
    {
1121 4
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.showResultsOfInitialQuery', $defaultIfEmpty);
1122 4
        return $this->getBool($result);
1123
    }
1124
1125
    /**
1126
     * Indicates if sorting was enabled or not.
1127
     *
1128
     * plugin.tx_solr.search.sorting
1129
     *
1130
     * @param bool $defaultIfEmpty
1131
     * @return bool
1132
     */
1133 17
    public function getSearchSorting($defaultIfEmpty = false)
1134
    {
1135 17
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.sorting', $defaultIfEmpty);
1136 17
        return $this->getBool($result);
1137
    }
1138
1139
    /**
1140
     * Returns the sorting options configurations.
1141
     *
1142
     * plugin.tx_solr.search.sorting.options.
1143
     *
1144
     * @param array $defaultIfEmpty
1145
     * @return array
1146
     */
1147 17
    public function getSearchSortingOptionsConfiguration($defaultIfEmpty = array())
1148
    {
1149 17
        $result = $this->getObjectByPathOrDefault('plugin.tx_solr.search.sorting.options.', $defaultIfEmpty);
1150 17
        return $result;
1151
    }
1152
1153
    /**
1154
     * Retrieves the sorting default order for a sort option.
1155
     *
1156
     * plugin.tx_solr.search.sorting.options.<sortOptionName>.defaultOrder
1157
     *
1158
     * or
1159
     *
1160
     * plugin.tx_solr.search.sorting.defaultOrder
1161
     *
1162
     *
1163
     * @param string $sortOptionName
1164
     * @param string $defaultIfEmpty
1165
     * @return string
1166
     */
1167 17
    public function getSearchSortingDefaultOrderBySortOptionName($sortOptionName = '', $defaultIfEmpty = 'asc')
1168
    {
1169 17
        $sortOrderSpecificPath = 'plugin.tx_solr.search.sorting.options.' . $sortOptionName . '.defaultOrder';
1170 17
        $specificSortOrder = $this->getValueByPathOrDefaultValue($sortOrderSpecificPath, null);
1171
1172
        // if we have a concrete setting, use it
1173 17
        if ($specificSortOrder !== null) {
1174
            return $specificSortOrder;
1175
        }
1176
1177
        // no specific setting, check common setting
1178 17
        $commonPath = 'plugin.tx_solr.search.sorting.defaultOrder';
1179 17
        $commonATagParamOrDefaultValue = $this->getValueByPathOrDefaultValue($commonPath, $defaultIfEmpty);
1180 17
        return $commonATagParamOrDefaultValue;
1181
    }
1182
1183
    /**
1184
     * Returns the configured fixedOrder, if nothing configured defaultIfEmpty will be returned.
1185
     *
1186
     * plugin.tx_solr.search.sorting.options.<sortOptionName>.fixedOrder
1187
     *
1188
     * @param string $sortOptionName
1189
     * @param string $defaultIfEmpty
1190
     * @return string
1191
     */
1192 17
    public function getSearchSortingFixedOrderBySortOptionName($sortOptionName = '', $defaultIfEmpty = '')
1193
    {
1194 17
        $fixedOrder = 'plugin.tx_solr.search.sorting.options.' . $sortOptionName . '.fixedOrder';
1195 17
        return $this->getValueByPathOrDefaultValue($fixedOrder, $defaultIfEmpty);
1196
    }
1197
1198
    /**
1199
     * Returns the trusted fields configured for the search that do not need to be escaped.
1200
     *
1201
     * @param array $defaultIfEmpty
1202
     * @return array
1203
     */
1204 18
    public function getSearchTrustedFieldsArray($defaultIfEmpty = array('url'))
1205
    {
1206 18
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.trustedFields', '');
1207
1208 18
        if (trim($result) === '') {
1209
            return $defaultIfEmpty;
1210
        }
1211
1212 18
        return GeneralUtility::trimExplode(',', $result);
1213
    }
1214
1215
    /**
1216
     * Indicates if the plugin arguments should be kept in the search form for a second submission.
1217
     *
1218
     * plugin.tx_solr.search.keepExistingParametersForNewSearches
1219
     *
1220
     * @param bool $defaultIfEmpty
1221
     * @return bool
1222
     */
1223 23
    public function getSearchKeepExistingParametersForNewSearches($defaultIfEmpty = false)
1224
    {
1225 23
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.keepExistingParametersForNewSearches', $defaultIfEmpty);
1226 23
        return $this->getBool($result);
1227
    }
1228
1229
    /**
1230
     * Returns if an empty query is allowed on the query level.
1231
     *
1232
     * plugin.tx_solr.search.query.allowEmptyQuery
1233
     *
1234
     * @param string $defaultIfEmpty
1235
     * @return string
1236
     */
1237 25
    public function getSearchQueryAllowEmptyQuery($defaultIfEmpty = '')
1238
    {
1239 25
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.query.allowEmptyQuery', $defaultIfEmpty);
1240 25
        return $this->getBool($result);
1241
    }
1242
1243
    /**
1244
     * Returns the fieldProcessingInstructions configuration array
1245
     *
1246
     * plugin.tx_solr.search.query.filter.
1247
     *
1248
     * @param array $defaultIfEmpty
1249
     * @return array
1250
     */
1251 31
    public function getSearchQueryFilterConfiguration(array $defaultIfEmpty = array())
1252
    {
1253 31
        $result = $this->getObjectByPathOrDefault('plugin.tx_solr.search.query.filter.', $defaultIfEmpty);
1254 31
        return $result;
1255
    }
1256
1257
    /**
1258
     * Can be used to overwrite the filterConfiguration.
1259
     *
1260
     * plugin.tx_solr.search.query.filter.
1261
     *
1262
     * @param array $configuration
1263
     */
1264 1
    public function setSearchQueryFilterConfiguration(array $configuration)
1265
    {
1266 1
        $this->configurationAccess->set('plugin.tx_solr.search.query.filter.', $configuration);
1267 1
    }
1268
1269
    /**
1270
     * Removes the pageSections filter setting.
1271
     *
1272
     * @return void
1273
     */
1274 2
    public function removeSearchQueryFilterForPageSections()
1275
    {
1276 2
        $this->configurationAccess->reset('plugin.tx_solr.search.query.filter.__pageSections');
1277 2
    }
1278
1279
    /**
1280
     * Returns the configured queryFields from TypoScript
1281
     *
1282
     * plugin.tx_solr.search.query.queryFields
1283
     *
1284
     * @param string $defaultIfEmpty
1285
     * @return string
1286
     */
1287 127
    public function getSearchQueryQueryFields($defaultIfEmpty = '')
1288
    {
1289 127
        return $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.query.queryFields', $defaultIfEmpty);
1290
    }
1291
1292
    /**
1293
     * Returns the configured returnFields as array.
1294
     *
1295
     * plugin.tx_solr.search.query.returnFields
1296
     *
1297
     * @param array $defaultIfEmpty
1298
     * @return array
1299
     */
1300 127
    public function getSearchQueryReturnFieldsAsArray($defaultIfEmpty = array())
1301
    {
1302 127
        $returnFields = $this->getValueByPath('plugin.tx_solr.search.query.returnFields');
1303 127
        if (is_null($returnFields)) {
1304 102
            return $defaultIfEmpty;
1305
        }
1306 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...
1307
    }
1308
1309
    /**
1310
     * Returns the configured target page for the search.
1311
     * By default the contextPageId will be used
1312
     *
1313
     * plugin.tx_solr.search.targetPage
1314
     *
1315
     * @return int
1316
     */
1317 132
    public function getSearchTargetPage()
1318
    {
1319 132
        $targetPage = (int)$this->getValueByPathOrDefaultValue('plugin.tx_solr.search.targetPage', 0);
1320 132
        if ($targetPage === 0) {
1321
            // when no specific page was configured we use the contextPageId (which is usual $GLOBALS['TSFE']->id)
1322 122
            $targetPage = $this->contextPageId;
1323
        }
1324
1325 132
        return $targetPage;
1326
    }
1327
1328
    /**
1329
     * Retrieves the targetPage configuration.
1330
     *
1331
     * plugin.tx_solr.search.targetPage.
1332
     *
1333
     * @param array $defaultIfEmpty
1334
     * @return array
1335
     */
1336 28
    public function getSearchTargetPageConfiguration(array $defaultIfEmpty = array())
1337
    {
1338 28
        $result = $this->getObjectByPathOrDefault('plugin.tx_solr.search.targetPage.', $defaultIfEmpty);
1339 28
        return $result;
1340
    }
1341
1342
    /**
1343
     * Retrieves the pagebrowser configuration.
1344
     *
1345
     * plugin.tx_solr.search.results.pagebrowser.
1346
     *
1347
     * @param array $defaultIfEmpty
1348
     * @return array
1349
     */
1350 18
    public function getSearchResultsPageBrowserConfiguration(array $defaultIfEmpty = array())
1351
    {
1352 18
        $result = $this->getObjectByPathOrDefault('plugin.tx_solr.search.results.pagebrowser.', $defaultIfEmpty);
1353 18
        return $result;
1354
    }
1355
1356
    /**
1357
     * Returns the result highlighting fields.
1358
     *
1359
     * plugin.tx_solr.search.results.resultsHighlighting.highlightFields
1360
     *
1361
     * @param string $defaultIfEmpty
1362
     * @return string
1363
     */
1364 30
    public function getSearchResultsHighlightingFields($defaultIfEmpty = '')
1365
    {
1366 30
        return $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.results.resultsHighlighting.highlightFields', $defaultIfEmpty);
1367
    }
1368
1369
    /**
1370
     * Returns the result highlighting fields as array.
1371
     *
1372
     * plugin.tx_solr.search.results.resultsHighlighting.highlightFields
1373
     *
1374
     * @param array $defaultIfEmpty
1375
     * @return array
1376
     */
1377 18
    public function getSearchResultsHighlightingFieldsAsArray($defaultIfEmpty = array())
1378
    {
1379 18
        $highlightingFields = $this->getSearchResultsHighlightingFields('');
1380
1381 18
        if ($highlightingFields === '') {
1382
            return $defaultIfEmpty;
1383
        }
1384
1385 18
        return GeneralUtility::trimExplode(',', $highlightingFields, true);
1386
    }
1387
1388
    /**
1389
     * Returns the fragmentSeparator for highlighted segments.
1390
     *
1391
     * plugin.tx_solr.search.results.resultsHighlighting.fragmentSeparator
1392
     *
1393
     * @param string $defaultIfEmpty
1394
     * @return string
1395
     */
1396 18
    public function getSearchResultsHighlightingFragmentSeparator($defaultIfEmpty = '[...]')
1397
    {
1398 18
        return $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.results.resultsHighlighting.fragmentSeparator', $defaultIfEmpty);
1399
    }
1400
1401
    /**
1402
     * Returns the number of results that should be shown per page.
1403
     *
1404
     * plugin.tx_solr.search.results.resultsPerPage
1405
     *
1406
     * @param int $defaultIfEmpty
1407
     * @return int
1408
     */
1409 23
    public function getSearchResultsPerPage($defaultIfEmpty = 10)
1410
    {
1411 23
        return (int)$this->getValueByPathOrDefaultValue('plugin.tx_solr.search.results.resultsPerPage', $defaultIfEmpty);
1412
    }
1413
1414
    /**
1415
     * Returns the available options for the per page switch.
1416
     *
1417
     * plugin.tx_solr.search.results.resultsPerPageSwitchOptions
1418
     *
1419
     * @param array $defaultIfEmpty
1420
     * @return array
1421
     */
1422 23
    public function getSearchResultsPerPageSwitchOptionsAsArray($defaultIfEmpty = array())
1423
    {
1424 23
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.results.resultsPerPageSwitchOptions', '');
1425
1426 23
        if (trim($result) === '') {
1427
            return $defaultIfEmpty;
1428
        }
1429
1430 23
        return GeneralUtility::intExplode(',', $result, true);
1431
    }
1432
1433
    /**
1434
     * Returns the configured wrap for the resultHighlighting.
1435
     *
1436
     * plugin.tx_solr.search.results.resultsHighlighting.wrap
1437
     *
1438
     * @param string $defaultIfEmpty
1439
     * @return string
1440
     */
1441 30
    public function getSearchResultsHighlightingWrap($defaultIfEmpty = '')
1442
    {
1443 30
        return $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.results.resultsHighlighting.wrap', $defaultIfEmpty);
1444
    }
1445
1446
    /**
1447
     * Indicates if spellchecking is enabled or not.
1448
     *
1449
     * plugin.tx_solr.search.spellchecking
1450
     *
1451
     * @param bool $defaultIfEmpty
1452
     * @return bool
1453
     */
1454 25
    public function getSearchSpellchecking($defaultIfEmpty = false)
1455
    {
1456 25
        $isFacetingEnabled = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.spellchecking', $defaultIfEmpty);
1457 25
        return $this->getBool($isFacetingEnabled);
1458
    }
1459
1460
    /**
1461
     * Returns the wrap that should be used for spellchecking
1462
     *
1463
     * plugin.tx_solr.search.spellchecking.wrap
1464
     *
1465
     * @param string $defaultIfEmpty
1466
     * @return string
1467
     */
1468 5
    public function getSearchSpellcheckingWrap($defaultIfEmpty = '')
1469
    {
1470 5
        return (string)$this->getValueByPathOrDefaultValue('plugin.tx_solr.search.spellchecking.wrap', $defaultIfEmpty);
1471
    }
1472
1473
    /**
1474
     * Returns the numberOfSuggestionsToTry that should be used for the spellchecking.
1475
     *
1476
     * plugin.tx_solr.search.spellchecking.numberOfSuggestionsToTry
1477
     *
1478
     * @param int $defaultIfEmpty
1479
     * @return int
1480
     */
1481 22
    public function getSearchSpellcheckingNumberOfSuggestionsToTry($defaultIfEmpty = 0)
1482
    {
1483 22
        return (int)$this->getValueByPathOrDefaultValue('plugin.tx_solr.search.spellchecking.numberOfSuggestionsToTry', $defaultIfEmpty);
1484
    }
1485
1486
    /**
1487
     * Indicates if a second search should be fired from the spellchecking suggestion if no results could be found.
1488
     *
1489
     * plugin.tx_solr.search.spellchecking.searchUsingSpellCheckerSuggestion
1490
     *
1491
     * @param bool $defaultIfEmpty
1492
     * @return bool
1493
     */
1494 3
    public function getSearchSpellcheckingSearchUsingSpellCheckerSuggestion($defaultIfEmpty = false)
1495
    {
1496 3
        $result = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.spellchecking.searchUsingSpellCheckerSuggestion', $defaultIfEmpty);
1497 3
        return $this->getBool($result);
1498
    }
1499
1500
    /**
1501
     * Indicates if faceting is enabled or not.
1502
     *
1503
     * plugin.tx_solr.search.faceting
1504
     *
1505
     * @param bool $defaultIfEmpty
1506
     * @return bool
1507
     */
1508 20
    public function getSearchFaceting($defaultIfEmpty = false)
1509
    {
1510 20
        $isFacetingEnabled = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.faceting', $defaultIfEmpty);
1511 20
        return $this->getBool($isFacetingEnabled);
1512
    }
1513
1514
    /**
1515
     * Retrieves the facetLinkATagParams for a facet by facet name. If nothing specific is configured
1516
     * the global facetLinkATagParams with be returned.
1517
     *
1518
     * plugin.tx_solr.search.faceting.facets.<facetName>.facetLinkATagParams
1519
     *
1520
     * or
1521
     *
1522
     * plugin.tx_solr.search.faceting.facetLinkATagParams
1523
     *
1524
     *
1525
     * @param string $facetName
1526
     * @param string $defaultIfEmpty
1527
     * @return string
1528
     */
1529 19
    public function getSearchFacetingFacetLinkATagParamsByName($facetName = '', $defaultIfEmpty = '')
1530
    {
1531 19
        $facetSpecificPath = 'plugin.tx_solr.search.faceting.facets.' . $facetName . '.facetLinkATagParams';
1532 19
        $specificATagParam = $this->getValueByPathOrDefaultValue($facetSpecificPath, null);
1533
1534
            // if we have a concrete setting, use it
1535 19
        if ($specificATagParam !== null) {
1536 1
            return $specificATagParam;
1537
        }
1538
1539
            // no specific setting, check common setting
1540 19
        $commonPath = 'plugin.tx_solr.search.faceting.facetLinkATagParams';
1541 19
        $commonATagParamOrDefaultValue = $this->getValueByPathOrDefaultValue($commonPath, $defaultIfEmpty);
1542 19
        return $commonATagParamOrDefaultValue;
1543
    }
1544
1545
    /**
1546
     * Returns the test that should be used to remove a faceting link
1547
     *
1548
     * plugin.tx_solr.search.faceting.removeFacetLinkText
1549
     *
1550
     * @param string $defaultIfEmpty
1551
     * @return string
1552
     */
1553 1
    public function getSearchFacetingRemoveFacetLinkText($defaultIfEmpty = '@facetLabel: @facetText')
1554
    {
1555 1
        return (string)$this->getValueByPathOrDefaultValue('plugin.tx_solr.search.faceting.removeFacetLinkText', $defaultIfEmpty);
1556
    }
1557
1558
    /**
1559
     * Retrieves the showEvenWhenEmpty for a facet by facet name. If nothing specific is configured
1560
     * the global showEmptyFacets with be returned.
1561
     *
1562
     * plugin.tx_solr.search.faceting.facets.<facetName>.showEvenWhenEmpty
1563
     *
1564
     * or
1565
     *
1566
     * plugin.tx_solr.search.faceting.showEmptyFacets
1567
     *
1568
     *
1569
     * @param string $facetName
1570
     * @param bool $defaultIfEmpty
1571
     * @return bool
1572
     */
1573 19
    public function getSearchFacetingShowEmptyFacetsByName($facetName = '', $defaultIfEmpty = false)
1574
    {
1575 19
        $facetSpecificPath = 'plugin.tx_solr.search.faceting.facets.' . $facetName . '.showEvenWhenEmpty';
1576 19
        $specificShowWhenEmpty = $this->getValueByPathOrDefaultValue($facetSpecificPath, null);
1577
1578
        // if we have a concrete setting, use it
1579 19
        if ($specificShowWhenEmpty !== null) {
1580 1
            return $specificShowWhenEmpty;
1581
        }
1582
1583
        // no specific setting, check common setting
1584 19
        $commonPath = 'plugin.tx_solr.search.faceting.showEmptyFacets';
1585 19
        $commonIfEmptyOrDefaultValue = $this->getValueByPathOrDefaultValue($commonPath, $defaultIfEmpty);
1586 19
        return $commonIfEmptyOrDefaultValue;
1587
    }
1588
1589
    /**
1590
     * Returns the wrap for the faceting show all link
1591
     *
1592
     * plugin.tx_solr.search.faceting.showAllLink.wrap
1593
     *
1594
     * @param string $defaultIfEmpty
1595
     * @return string
1596
     */
1597
    public function getSearchFacetingShowAllLinkWrap($defaultIfEmpty = '')
1598
    {
1599
        return (string)$this->getValueByPathOrDefaultValue('plugin.tx_solr.search.faceting.showAllLink.wrap', $defaultIfEmpty);
1600
    }
1601
1602
    /**
1603
     * Returns the link url parameters that should be added to a facet.
1604
     *
1605
     * plugin.tx_solr.search.faceting.facetLinkUrlParameters
1606
     *
1607
     * @param string $defaultIfEmpty
1608
     * @return string
1609
     */
1610 18
    public function getSearchFacetingFacetLinkUrlParameters($defaultIfEmpty = '')
1611
    {
1612 18
        $linkUrlParameters = trim($this->getValueByPathOrDefaultValue('plugin.tx_solr.search.faceting.facetLinkUrlParameters', $defaultIfEmpty));
1613
1614 18
        return $linkUrlParameters;
1615
    }
1616
1617
    /**
1618
     * Returns if the facetLinkUrlsParameters should be included in the reset link.
1619
     *
1620
     * plugin.tx_solr.search.faceting.facetLinkUrlParameters.useForFacetResetLinkUrl
1621
     *
1622
     * @param bool $defaultIfEmpty
1623
     * @return bool
1624
     */
1625 18
    public function getSearchFacetingFacetLinkUrlParametersUseForFacetResetLinkUrl($defaultIfEmpty = true)
1626
    {
1627 18
        $useForFacetResetLinkUrl = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.faceting.facetLinkUrlParameters.useForFacetResetLinkUrl', $defaultIfEmpty);
1628 18
        return $this->getBool($useForFacetResetLinkUrl);
1629
    }
1630
1631
    /**
1632
     * Returns the link url parameters that should be added to a facet as array.
1633
     *
1634
     * plugin.tx_solr.search.faceting.facetLinkUrlParameters
1635
     *
1636
     * @param array $defaultIfEmpty
1637
     * @return array
1638
     */
1639 18
    public function getSearchFacetingFacetLinkUrlParametersAsArray($defaultIfEmpty = array())
1640
    {
1641 18
        $linkUrlParameters = $this->getSearchFacetingFacetLinkUrlParameters();
1642 18
        if ($linkUrlParameters === '') {
1643
            return $defaultIfEmpty;
1644
        }
1645
1646 18
        return GeneralUtility::explodeUrl2Array($linkUrlParameters);
1647
    }
1648
1649
    /**
1650
     * Return the configured minimumCount value for facets.
1651
     *
1652
     * plugin.tx_solr.search.faceting.minimumCount
1653
     *
1654
     * @param int $defaultIfEmpty
1655
     * @return int
1656
     */
1657 31
    public function getSearchFacetingMinimumCount($defaultIfEmpty = 1)
1658
    {
1659 31
        return (int)$this->getValueByPathOrDefaultValue('plugin.tx_solr.search.faceting.minimumCount', $defaultIfEmpty);
1660
    }
1661
1662
    /**
1663
     * Return the configured limit value for facets.
1664
     *
1665
     * plugin.tx_solr.search.faceting.limit
1666
     *
1667
     * @param int $defaultIfEmpty
1668
     * @return int
1669
     */
1670 18
    public function getSearchFacetingLimit($defaultIfEmpty = 10)
1671
    {
1672 18
        return (int)$this->getValueByPathOrDefaultValue('plugin.tx_solr.search.faceting.limit', $defaultIfEmpty);
1673
    }
1674
1675
    /**
1676
     * Returns if the singleFacetMode is active or not.
1677
     *
1678
     * plugin.tx_solr.search.faceting.singleFacetMode
1679
     *
1680
     * @param bool $defaultIfEmpty
1681
     * @return bool
1682
     */
1683 1
    public function getSearchFacetingSingleFacetMode($defaultIfEmpty = false)
1684
    {
1685 1
        $singleFacetMode = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.faceting.singleFacetMode', $defaultIfEmpty);
1686 1
        return $this->getBool($singleFacetMode);
1687
    }
1688
1689
    /**
1690
     * Return the configured faceting sortBy value.
1691
     *
1692
     * plugin.tx_solr.search.faceting.sortBy
1693
     *
1694
     * @param string $defaultIfEmpty
1695
     * @return string
1696
     */
1697 31
    public function getSearchFacetingSortBy($defaultIfEmpty = '')
1698
    {
1699 31
        return $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.faceting.sortBy', $defaultIfEmpty);
1700
    }
1701
1702
    /**
1703
     * Returns if a facets should be kept on selection. Global faceting setting
1704
     * can also be configured on facet level by using
1705
     * (plugin.tx_solr.search.faceting.facets.<fieldName>.keepAllOptionsOnSelection)
1706
     *
1707
     * plugin.tx_solr.search.faceting.keepAllFacetsOnSelection
1708
     *
1709
     * @param bool $defaultIfEmpty
1710
     * @return bool
1711
     */
1712 27
    public function getSearchFacetingKeepAllFacetsOnSelection($defaultIfEmpty = false)
1713
    {
1714 27
        $keepAllOptionsOnSelection = $this->getValueByPathOrDefaultValue('plugin.tx_solr.search.faceting.keepAllFacetsOnSelection', $defaultIfEmpty);
1715 27
        return $this->getBool($keepAllOptionsOnSelection);
1716
    }
1717
1718
    /**
1719
     * Returns the configured faceting configuration.
1720
     *
1721
     * plugin.tx_solr.search.faceting.facets
1722
     *
1723
     * @param array $defaultIfEmpty
1724
     * @return array
1725
     */
1726 27
    public function getSearchFacetingFacets(array $defaultIfEmpty = array())
1727
    {
1728 27
        return $this->getObjectByPathOrDefault('plugin.tx_solr.search.faceting.facets.', $defaultIfEmpty);
1729
    }
1730
1731
    /**
1732
     * Returns the configuration of a single facet by facet name.
1733
     *
1734
     * plugin.tx_solr.search.faceting.facets.<facetName>
1735
     *
1736
     * @param string $facetName
1737
     * @param array $defaultIfEmpty
1738
     * @return array
1739
     */
1740 18
    public function getSearchFacetingFacetByName($facetName, $defaultIfEmpty = array())
1741
    {
1742 18
        return $this->getObjectByPathOrDefault('plugin.tx_solr.search.faceting.facets.' . $facetName . '.', $defaultIfEmpty);
1743
    }
1744
1745
    /**
1746
     * Indicates if statistics is enabled or not.
1747
     *
1748
     * plugin.tx_solr.statistics
1749
     *
1750
     * @param bool $defaultIfEmpty
1751
     * @return bool
1752
     */
1753 23
    public function getStatistics($defaultIfEmpty = false)
1754
    {
1755 23
        $isFacetingEnabled = $this->getValueByPathOrDefaultValue('plugin.tx_solr.statistics', $defaultIfEmpty);
1756 23
        return $this->getBool($isFacetingEnabled);
1757
    }
1758
1759
    /**
1760
     * Indicates to which length an ip should be anonymized in the statistics
1761
     *
1762
     * plugin.tx_solr.statistics.anonymizeIP
1763
     *
1764
     * @param int $defaultIfEmpty
1765
     * @return int
1766
     */
1767 18
    public function getStatisticsAnonymizeIP($defaultIfEmpty = 0)
1768
    {
1769 18
        $anomizeToLength = $this->getValueByPathOrDefaultValue('plugin.tx_solr.statistics.anonymizeIP', $defaultIfEmpty);
1770 18
        return (int)$anomizeToLength;
1771
    }
1772
1773
    /**
1774
     * Indicates if suggestion is enabled or not.
1775
     *
1776
     * plugin.tx_solr.suggest
1777
     *
1778
     * @param bool $defaultIfEmpty
1779
     * @return bool
1780
     */
1781 25
    public function getSuggest($defaultIfEmpty = false)
1782
    {
1783 25
        $isSuggestionEnabled = $this->getValueByPathOrDefaultValue('plugin.tx_solr.suggest', $defaultIfEmpty);
1784 25
        return $this->getBool($isSuggestionEnabled);
1785
    }
1786
1787
    /**
1788
     * Indicates if https should be used for the suggest form.
1789
     *
1790
     * plugin.tx_solr.suggest.forceHttps
1791
     *
1792
     * @param bool $defaultIfEmpty
1793
     * @return bool
1794
     */
1795 25
    public function getSuggestForceHttps($defaultIfEmpty = false)
1796
    {
1797 25
        $isHttpsForced = $this->getValueByPathOrDefaultValue('plugin.tx_solr.suggest.forceHttps', $defaultIfEmpty);
1798 25
        return $this->getBool($isHttpsForced);
1799
    }
1800
1801
    /**
1802
     * Returns the configured template for a specific template fileKey.
1803
     *
1804
     * plugin.tx_solr.search.templateFiles.<fileKey>
1805
     *
1806
     * @param string $fileKey
1807
     * @param string $defaultIfEmpty
1808
     * @return string
1809
     */
1810 25
    public function getTemplateByFileKey($fileKey, $defaultIfEmpty = '')
1811
    {
1812 25
        $templateFileName = $this->getValueByPathOrDefaultValue('plugin.tx_solr.templateFiles.' . $fileKey, $defaultIfEmpty);
1813 25
        return (string)$templateFileName;
1814
    }
1815
1816
    /**
1817
     * Returns the configuration of the crop view helper.
1818
     *
1819
     * plugin.tx_solr.viewHelpers.crop.
1820
     *
1821
     * @param array $defaultIfEmpty
1822
     * @return array
1823
     */
1824 1
    public function getViewHelpersCropConfiguration(array $defaultIfEmpty = array())
1825
    {
1826 1
        $cropViewHelperConfiguration = $this->getObjectByPathOrDefault('plugin.tx_solr.viewHelpers.crop.', $defaultIfEmpty);
1827 1
        return $cropViewHelperConfiguration;
1828
    }
1829
1830
    /**
1831
     * Returns the configuration of the sorting view helper.
1832
     *
1833
     * plugin.tx_solr.viewHelpers.sortIndicator.
1834
     *
1835
     * @param array $defaultIfEmpty
1836
     * @return array
1837
     */
1838 17
    public function getViewHelpersSortIndicatorConfiguration(array $defaultIfEmpty = array())
1839
    {
1840 17
        $sortingViewHelperConfiguration = $this->getObjectByPathOrDefault('plugin.tx_solr.viewHelpers.sortIndicator.', $defaultIfEmpty);
1841 17
        return $sortingViewHelperConfiguration;
1842
    }
1843
1844
    /**
1845
     * Gets an array of tables configured for indexing by the Index Queue. Since the
1846
     * record monitor must watch these tables for manipulation.
1847
     *
1848
     * @return array Array of table names to be watched by the record monitor.
1849
     */
1850
    public function getMonitoredTables()
1851
    {
1852
        $monitoredTables = array();
1853
1854
        $indexingConfigurations =  $this->getEnabledIndexQueueConfigurationNames();
1855
        foreach ($indexingConfigurations as $indexingConfigurationName) {
1856
            $monitoredTable = $this->getIndexQueueTableNameOrFallbackToConfigurationName($indexingConfigurationName);
1857
            $monitoredTables[] = $monitoredTable;
1858
            if ($monitoredTable == 'pages') {
1859
                // when monitoring pages, also monitor creation of translations
1860
                $monitoredTables[] = 'pages_language_overlay';
1861
            }
1862
        }
1863
1864
        return array_unique($monitoredTables);
1865
    }
1866
}
1867