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