[
https://issues.apache.org/jira/browse/CAMEL-9736?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15208046#comment-15208046
]
Claus Ibsen commented on CAMEL-9736:
------------------------------------
Andrea do you want to take a look, eg if that header is present then use that
as content-type and then only if not, fallback and read the content type from
the file as the code above does.
> SolrComponent gets the wrong Content Type
> -----------------------------------------
>
> Key: CAMEL-9736
> URL: https://issues.apache.org/jira/browse/CAMEL-9736
> Project: Camel
> Issue Type: Improvement
> Components: camel-solr
> Affects Versions: 2.16.2
> Environment: Linux
> Reporter: Mansour Al Akeel
> Assignee: Andrea Cosentino
> Priority: Minor
> Labels: content-type, indexing, solr
> Fix For: 2.18.0, 2.17.1
>
>
> 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.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)