ext-solr
ext-solr copied to clipboard
[BUG] Solr response 400 ("Bad request") due to illegal characters?
Describe the bug
A 400 ("Bad request") response from solr doesn't seem to be handled as an error but leads to the indexing queue being stuck at where it's at.
To Reproduce
We've got the following config for tx_news_domain_model_news
records:
plugin.tx_solr.index.queue.tx_news_domain_model_news.fields {
....
teaser = teaser
content = SOLR_CONTENT
content {
cObject = COA
cObject {
10 = TEXT
10 {
field = bodytext
noTrimWrap = || |
}
20 = SOLR_RELATION
20 {
localField = content_elements
foreignLabelField = bodytext
singleValueGlue = | |
}
}
}
...
}
The error can only be seen after adding an else
into EXT:solr/Classes/IndexQueue/Index.php->indexItem()
:
if ($response->getHttpStatus() == 200) {
$itemIndexed = true;
} else {
var_dump($item);
var_dump($itemDocument);
var_dump($response);
throw new Exception('Solr Response: ' . $response->getHttpStatusMessage(), 1637318787);
}
Here's the error message:
Error adding field 'content'='lorem ipsum' msg=Multiple values encountered for non multiValued copy field teaser: lorem ipsum"
I can only assume that it's gotta be related to that part of general_schema_fields.xml
:
<copyField source="content" dest="teaser" maxChars="300" />
Expected behavior
The indexing failure should be properly logged as an error and the item thus skipped on subsequent runs.
Used versions:
- TYPO3 Version: 9 and 10
- EXT:solr Version: 11.0.x
- Used Apache Solr Version: 8.2.0
- PHP Version: 7.4.0