On Sat, Jun 16, 2012 at 5:59 PM, 12rad <[email protected]> wrote:
> Hi,
>
> I'm new to SolrJ.
Hi and welcome!
> Here I are the steps I followed to write an application to index pdf
> documents to fresh solr3.6
>
> 1 -In Schema.xml:
> I added the fields I wanted indexed and changed stored = true.
>
> 2 - Started Solr using java -jar start.jar from the /example dir in Solr 3.6
>
> 3- In my application I start the server
> solrServer = new CommonsHttpSolrServer(url);
> solrServer.setParser(new XMLResponseParser());
>
> 4 - i index the data like this:
> ContentStreamUpdateRequest index = new
> ContentStreamUpdateRequest("/update/extract");
> index.setParam("literal.id", "doc");
> index.setParam(CommonParams.STREAM_FILE, "/location/x.pdf");
> index.setParam(CommonParams.STREAM_CONTENTTYPE, "application/pdf");
> index.setParam(UpdateParams.COMMIT, "true");
Are you sending the request to solr? ie something like
solrServer.request(index);
Here's a simple snippet that sends a pdf to be indexed in solr (3.6):
SolrServer server = ...
ContentStreamUpdateRequest req = new ContentStreamUpdateRequest(
"/update/extract");
req.setParam("literal.id", "doc");
req.addFile(new File(
"solr/contrib/dataimporthandler-extras/src/test-files/dihextras/solr-word.pdf"));
server.request(req);
server.commit();
--
Sami Siren