ext-solr
ext-solr copied to clipboard
Handle solr responses != 200
What this pr does
This make sure that a non 200 response from solr is handled as a proper error. This patch is considered as a workaround rather than the actual solution. I leave that to the pro's ;-)
How to test
Make solr return a status 400 and nothing should happen to the index queue item. Then apply this patch and the item should be handled as an error and subsequent runs should be processing the next items in line.
Related: #3108
@kitzberger
Thanks for reporting and advice.
It seems the exceptions are caught in IndexService
https://github.com/TYPO3-Solr/ext-solr/blob/03080d4d55eeb9d50b15348f445d23e57e34e461/Classes/Domain/Index/IndexService.php#L127-L138
The newly added exception will not interrupt the indexing process, and the error message will be delegated to the index queue item. That is fine to not to interrupt the process, but that all is at least strange, because
the Solarium//HttpException
exception, which is caught in next lines after your change, should be thrown on 400+ status codes. See description of Solarium//HttpException
:
https://github.com/solariumphp/solarium/blob/5b2cc069b30bd990e9130e7a3b8c54ce4b1fe04a/src/Exception/HttpException.php#L12-L27
See example:
https://github.com/solariumphp/solarium/blob/090c447cdab59051191f936cbaec905752bcc7b1/src/Core/Query/Result/Result.php#L58-L75
IMHO we should inspect the try-catch block and why is HttpException not thrown on 400+.
I am closing this PR as the problem has been resolved in the meantime, see https://github.com/TYPO3-Solr/ext-solr/pull/3539