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