Details
-
Type:
Improvement
-
Status: Resolved
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 2.16.2
-
Component/s: camel-solr
-
Labels:
-
Environment:
Linux
-
Estimated Complexity:Novice
Description
Currently, there is no way to specify the content type. It's extracted automatically from the File in the body of the Message. This results in error when indexing a document. Setting Exchange.CONTENT_TYPE or Exchange.FILE_CONTENT_TYPE does not help.
For example, neither of these would work, as the component ignores the header and reads the file type in SolrProducer:
if (body instanceof File) {
MimetypesFileTypeMap mimeTypesMap = new MimetypesFileTypeMap();
String mimeType = mimeTypesMap.getContentType((File)body);
ContentStreamUpdateRequest updateRequest = new
ContentStreamUpdateRequest(getRequestHandler());
updateRequest.addFile((File) body, mimeType);
A simple solution could be to check if the Exchange.FILE_CONTENT_TYPE is set, before trying to extract if from mimeTypesMap.