简体   繁体   English

在Java中将pdf文档添加到Solr

[英]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? 我可以在Java添加类似的字段,但是我想在Java使用SolrJ将pdf文档添加到Solr中,如何添加pdf文件?

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();

Solr uses Apache Tika to process binary files. Solr使用Apache Tika处理二进制文件。

See http://wiki.apache.org/solr/ExtractingRequestHandler and http://wiki.apache.org/solr/ContentStreamUpdateRequestExample for a SolrJ example. 有关SolrJ示例,请参见http://wiki.apache.org/solr/ExtractingRequestHandlerhttp://wiki.apache.org/solr/ContentStreamUpdateRequestExample

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM