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