为solr中的文档编制索引时出错-SolrException

为solr中的文档编制索引时出错-SolrException,solr,Solr,我正在使用以下代码为solr server中的文档编制索引 String urlString = "http://localhost:8080/solr"; SolrServer solr = new CommonsHttpSolrServer(urlString); java.io.File file=new java.io.File("C:\\Users\\Guruprasad\\Desktop\\Search\\47975832.doc"); if (file.c

我正在使用以下代码为solr server中的文档编制索引

String urlString = "http://localhost:8080/solr";            
SolrServer solr = new CommonsHttpSolrServer(urlString);
java.io.File file=new java.io.File("C:\\Users\\Guruprasad\\Desktop\\Search\\47975832.doc");

if (file.canRead()) {

        System.out.println("adding " + file);
        try {
            ContentStreamUpdateRequest req = new ContentStreamUpdateRequest("/update/extract");
            String parts[] = file.getName().split("\\.");
            String type = "text";
            if (parts.length>1) {
                type = parts[1];
            }
            req.addFile(file);
            req.setParam("literal.id", file.getAbsolutePath());
            req.setParam("literal.name", file.getName());
            req.setParam("literal.content_type", type);
            req.setParam("uprefix", "attr_");
            req.setParam("fmap.content", "attr_content");
            req.setAction(ACTION.COMMIT, true, true);

            solr.request(req);* //**Line no 36** here i am getting exception 
在执行此代码时,我遇到以下异常

异常:org.apache.solr.common.SolrException

异常消息:

Internal Server Error Internal Server Error request: 

 http://localhost:8080/solr/update/extract?literal.id=C:\Users\Guruprasad\Desktop\Search\47975832.doc&literal.name=47975832.doc&literal.content_type=doc&uprefix=attr_&fmap.content=attr_content&commit=true&waitFlush=true&waitSearcher=true&wt=javabin&version=2
异常跟踪:

at   org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:435)
at   org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:244)
at   com.solr.search.test.IndexFiles.indexDocs(IndexFiles.java:36)* 

任何帮助都是有用的

我不建议您使用dih索引数据库数据,您可以使用solrj索引数据,solrj很简单,如果您可以使用jdbc,那么事情就很简单,您可以使用solrj构建solr文档并将批处理数据提交到solr服务器。有一个solrj wiki,希望它能帮助你

solr 5.0自带了一个内置的实用工具DIH处理程序,用于索引你正在使用的数据库中的数据,但它的配置很重要,也很棘手。你能发布你的DIH处理程序配置或共享导入日志吗?我觉得配置有问题