【问题标题】:Error while indexing documents in solr - SolrException在 solr 中索引文档时出错 - SolrException
【发布时间】:2015-10-28 12:11:14
【问题描述】:

我正在使用以下代码来索引 solr 服务器中的文档。

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)* 

任何帮助都会很有用

【问题讨论】:

    标签: solr


    【解决方案1】:

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

    【讨论】:

      【解决方案2】:

      solr 5.0 带有内置实用程序 DIH 处理程序,用于从您正在使用的数据库中索引数据,但它的配置很重要且很棘手,请您发布您的 DIH 处理程序配置或共享导入日志,这对我来说似乎是配置问题

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2017-03-05
        • 2011-02-17
        • 1970-01-01
        • 1970-01-01
        • 2011-05-27
        • 2012-08-23
        • 2019-02-21
        • 1970-01-01
        相关资源
        最近更新 更多