mirror of
https://github.com/silverstripe/silverstripe-textextraction
synced 2024-10-22 11:06:00 +02:00
FIX additional exception handling for Tika errors return via Guzzle.
Tika server errors via Guzzle can cause the Solr search query to return a 500 error and breaks search results pages for users. Issues was relating to uncaught exceptions from Guzzle causing a silent fail if a text file is perhaps unreadable or missing (return null never occurs which breaks the search).
This commit is contained in:
parent
a380bb7c8f
commit
a34c443be5
@ -72,7 +72,19 @@ class SolrCellTextExtractor extends FileTextExtractor {
|
|||||||
SS_Log::NOTICE
|
SS_Log::NOTICE
|
||||||
);
|
);
|
||||||
return null;
|
return null;
|
||||||
|
} catch(Guzzle\Http\Exception\ServerErrorResponseException $e){
|
||||||
|
//catch other errors that Tika can throw vai Guzzle but are not caught and break Solr search query in some cases.
|
||||||
|
SS_Log::log(
|
||||||
|
sprintf(
|
||||||
|
'Tika server error attempting to extract from "%s" (message: %s)',
|
||||||
|
$path,
|
||||||
|
$e->getMessage()
|
||||||
|
),
|
||||||
|
SS_Log::NOTICE
|
||||||
|
);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use preg match to avoid SimpleXML running out of memory on large text nodes
|
// Use preg match to avoid SimpleXML running out of memory on large text nodes
|
||||||
preg_match(
|
preg_match(
|
||||||
sprintf('/\<str name\="%s"\>(.*?)\<\/str\>/s', preg_quote($fileName)),
|
sprintf('/\<str name\="%s"\>(.*?)\<\/str\>/s', preg_quote($fileName)),
|
||||||
|
Loading…
Reference in New Issue
Block a user