Following the sample in
<http://wiki.apache.org/solr/ContentStreamUpdateRequestExample>
http://wiki.apache.org/solr/ContentStreamUpdateRequestExample I'm able to
insert a PDF and search words, etc.


ContentStreamUpdateRequest up = new
ContentStreamUpdateRequest("/update/extract");
up.addFile(new File(fileName), "application/pdf");
up.setParam("literal.id", solrId);
up.setParam("uprefix", "attr_");
up.setParam("fmap.content", "attr_content");



My problem is that I have created some fields for a document (in
schema.xml), for example

<field name="docName" type="text_es" indexed="true" stored="true"/>
<field name="description" type="text_es" indexed="true" stored="true"/>

They use the text_es definition, for spanish text, and if I insert data
directly into this fields it works nice (plural, etc...)

But if I want to add data from PDF (or other) files directly to them, what I
have to change in the code? Can I change the attributes in the
ContentStreamUpdateRequest to do it? What do I have to write in these lines
of code to insert into description the PDF file content?

up.setParam("literal.id", solrId); //I suppose this line does not change
up.setParam("uprefix", "attr_");
up.setParam("fmap.content", "attr_content");

And what I have to add to enter the other fields like put a docName? So when
I search for a word in the document I get "SolrDocument{id= ...,
attr_content=[ ... ], version_=... But I want to add some attributes like
docName or other with my values inserted in my code.

By the way I'm using Solr version 4.6.0 and SolrJ in Java for the code.

Regards.





---
Este mensaje no contiene virus ni malware porque la protección de avast! 
Antivirus está activa.
http://www.avast.com

Reply via email to