user527
user527

Reputation: 205

Adding pdf document to Solr in Java

I can add field like this in Java, but I want to add pdf document to Solr with SolrJ in Java, how can I add a pdf file?

CommonsHttpSolrServer server = new CommonsHttpSolrServer("http://localhost:8983/solr");

SolrInputDocument doc = new SolrInputDocument();

doc.addField("cat", "lalal");
doc.addField("id", "1");

server.add(doc);
server.commit();

Upvotes: 0

Views: 2873

Answers (1)

pap
pap

Reputation: 27614

Solr uses Apache Tika to process binary files.

See http://wiki.apache.org/solr/ExtractingRequestHandler and http://wiki.apache.org/solr/ContentStreamUpdateRequestExample for a SolrJ example.

Upvotes: 3

Related Questions