You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Koorosh Vakhshoori <kv...@gmail.com> on 2012/06/07 23:32:14 UTC

ContentStreamUpdateRequest method addFile in 4.0 release.

In latest 4.0 release, the addFile() method has a new argument 'contentType':

addFile(File file, String contentType)

In context of Solr Cell how should addFile() method be called? Specifically
I refer to the Wiki example:

ContentStreamUpdateRequest up = new
ContentStreamUpdateRequest("/update/extract");
up.addFile(new File("mailing_lists.pdf"));
up.setParam("literal.id", "mailing_lists.pdf");
up.setAction(AbstractUpdateRequest.ACTION.COMMIT, true, true);
result = server.request(up);
assertNotNull("Couldn't upload mailing_lists.pdf", result);
rsp = server.query( new SolrQuery( "*:*") );
Assert.assertEquals( 1, rsp.getResults().getNumFound() );

given at URL: http://wiki.apache.org/solr/ExtractingRequestHandler

Since Solr Cell is calling Tika under the hood, doesn't the file
content-type is already identified by Tika? Looking at the code, it seems
passing NULL would do the job, is that correct? Also for Solr Cell, is the
ContentStreamUpdateRequest class is the right one to use or there is a
different class that is more appropriate here?

Thanks
 

--
View this message in context: http://lucene.472066.n3.nabble.com/ContentStreamUpdateRequest-method-addFile-in-4-0-release-tp3988344.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: ContentStreamUpdateRequest method addFile in 4.0 release.

Posted by Ryan McKinley <ry...@gmail.com>.
for the ExtractingRequestHandler, you can put anything into the
request contentType.

try:
addFile( file, "application/octet-stream" )

but anything should work

ryan




On Thu, Jun 7, 2012 at 2:32 PM, Koorosh Vakhshoori
<kv...@gmail.com> wrote:
> In latest 4.0 release, the addFile() method has a new argument 'contentType':
>
> addFile(File file, String contentType)
>
> In context of Solr Cell how should addFile() method be called? Specifically
> I refer to the Wiki example:
>
> ContentStreamUpdateRequest up = new
> ContentStreamUpdateRequest("/update/extract");
> up.addFile(new File("mailing_lists.pdf"));
> up.setParam("literal.id", "mailing_lists.pdf");
> up.setAction(AbstractUpdateRequest.ACTION.COMMIT, true, true);
> result = server.request(up);
> assertNotNull("Couldn't upload mailing_lists.pdf", result);
> rsp = server.query( new SolrQuery( "*:*") );
> Assert.assertEquals( 1, rsp.getResults().getNumFound() );
>
> given at URL: http://wiki.apache.org/solr/ExtractingRequestHandler
>
> Since Solr Cell is calling Tika under the hood, doesn't the file
> content-type is already identified by Tika? Looking at the code, it seems
> passing NULL would do the job, is that correct? Also for Solr Cell, is the
> ContentStreamUpdateRequest class is the right one to use or there is a
> different class that is more appropriate here?
>
> Thanks
>
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/ContentStreamUpdateRequest-method-addFile-in-4-0-release-tp3988344.html
> Sent from the Solr - User mailing list archive at Nabble.com.