dqprf0976 2017-03-07 10:37 采纳率: 100%
浏览 97
已采纳

从Apache Solr中的CSV文件索引数据

I have followed the tutorials given in below link

Indexing csv file in solr

I have configured solr server in my local and

But when i try to post csv file using the below command

java -Dtype=text/csv -Durl=http://localhost:8983/solr/jcg/update -jar post.jar  books.csv

I am getting below error response in command prompt

Any one help why i am getting the error response

Error:

<response>
<lst name="responseHeader"><int name="status">400</int><int name="QTime">111</int></lst><lst name="error"><lst name="metadata"><str name="error-class">org.apache.solr.common.SolrException</str><str name="root-error-class">org.apache.solr.common.SolrException</str></lst><str name=
"msg">ERROR: [doc=0553573403] unknown field 'cat'</str><int name="code">400</int></lst>
</response>
  • 写回答

1条回答 默认 最新

  • dquv73115 2017-03-07 13:21
    关注

    The tutorial you're following is quite old, so if you want follow the tutorial there are two options:

    1. the tutorial you're following misses the creation of Schema configuration in jcg collection. In this case you should fix your managed-schema file to jcg configuration taking care to add the following fields as suggested in the Tutorial, then reload the configuration (or restart Solr). At this point the "Indexing the Data" step should work correctly.
     <uniqueKey>id</uniqueKey>
     <!-- Fields added for books.csv load-->
     <field name="cat" type="text_general" indexed="true" stored="true"/>
     <field name="name" type="text_general" indexed="true" stored="true"/>
     <field name="price" type="tdouble" indexed="true" stored="true"/>
     <field name="inStock" type="boolean" indexed="true" stored="true"/>
     <field name="author" type="text_general" indexed="true" stored="true"/>
    
    1. You have correctly added schema and fields but not reloaded the configuration, but not reloaded the collection. So just reload the configuration (or restart Solr) and continue with the tutorial.

    On the other hand, if you're using an earlier version of Solr (6.4) I suggest to delete jcg collection and create it again:

    bin/solr delete -c jcg
    bin/solr create -c jcg -d ./server/solr/configsets/sample_techproducts_configs  
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误