Skip to content

Commit f1057dd

Browse files
authored
Merge pull request #3406 from thekesolutions/dis_1653
DIS-1653: Add spellcheckMaxCollationTries to system_variables
2 parents c39411a + 5277fd8 commit f1057dd

File tree

4 files changed

+31
-2
lines changed

4 files changed

+31
-2
lines changed

code/web/release_notes/25.12.00.MD

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,10 @@
216216
### Indexing Updates
217217
- Add SolrCloud support by using the Schema API instead of downloading the schema file. (DIS-1569) (*TC*)
218218

219+
#### New Settings
220+
- System Administration > System Variables > Spellcheck Max Collation Tries (DIS-1653) (*TC*)
221+
- New setting to limit the number of tries for spellcheck collation to improve performance on large datasets.
222+
219223
## This release includes code contributions from
220224
### ByWater Solutions
221225
- Leo Stoyanov (LS)

code/web/sys/DBMaintenance/version_updates/25.12.00.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,17 @@ function getUpdates25_12_00(): array {
182182
genericArtCode TINYTEXT
183183
) ENGINE = InnoDB",
184184
]
185-
]
185+
],
186+
187+
// Tomas Cohen Arazi - Theke Solutions
188+
'configurable_solr_spellcheck_collation' => [
189+
'title' => 'SolR - Spellcheck Collation max tries',
190+
'description' => 'Make SolR spellcheck.maxCollationTries configurable',
191+
'sql' => [
192+
"ALTER TABLE system_variables ADD COLUMN spellcheckMaxCollationTries int(11) DEFAULT 25 AFTER solrQueryTimeout;"
193+
],
194+
],
195+
186196
//other
187197

188198
];

code/web/sys/SolrConnector/Solr.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1332,6 +1332,10 @@ function search($query, $handler = null, $filter = null, $start = 0, $limit = 20
13321332

13331333
// Enable Spell Checking
13341334
if ($spell != '') {
1335+
require_once ROOT_DIR . '/sys/SystemVariables.php';
1336+
$systemVariables = SystemVariables::getSystemVariables();
1337+
$maxCollationTries = ($systemVariables && $systemVariables->spellcheckMaxCollationTries > 0) ? $systemVariables->spellcheckMaxCollationTries : 25;
1338+
13351339
$options['spellcheck'] = 'true';
13361340
$options['spellcheck.q'] = $spell;
13371341
// if ($dictionary != null) {
@@ -1347,7 +1351,7 @@ function search($query, $handler = null, $filter = null, $start = 0, $limit = 20
13471351
$options['spellcheck.collateParam.mm'] = '100%';
13481352
$options['spellcheck.maxCollations'] = 5;
13491353
$options['spellcheck.collateExtendedResults'] = 'true';
1350-
$options['spellcheck.maxCollationTries'] = 25;
1354+
$options['spellcheck.maxCollationTries'] = $maxCollationTries;
13511355
$options['spellcheck.accuracy'] = .5;
13521356
}
13531357

code/web/sys/SystemVariables.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ class SystemVariables extends DataObject {
3232
public $libraryToUseForPayments;
3333
public $solrConnectTimeout;
3434
public $solrQueryTimeout;
35+
public $spellcheckMaxCollationTries;
3536
public $catalogStatus;
3637
public $offlineMessage;
3738
public $appScheme;
@@ -303,6 +304,16 @@ static function getObjectStructure(string $context = ''): array {
303304
'default' => 10,
304305
'min' => 1,
305306
],
307+
'spellcheckMaxCollationTries' => [
308+
'property' => 'spellcheckMaxCollationTries',
309+
'type' => 'integer',
310+
'label' => 'Spellcheck Max Collation Tries',
311+
'description' => 'Maximum number of collation attempts for spellcheck queries (lower values improve performance)',
312+
'required' => true,
313+
'default' => 25,
314+
'min' => 1,
315+
'max' => 50,
316+
],
306317
'catalogStatus' => [
307318
'property' => 'catalogStatus',
308319
'type' => 'enum',

0 commit comments

Comments
 (0)