简体   繁体   English

Solr服务器发布错误

[英]Solr Server Posting Error

How to post 5000 files to Solr server? 如何将5000个文件发布到Solr服务器? While posting by using command "java -jar post.jar dir/*.xml", command tool tells Argument list is too long. 使用命令“ java -jar post.jar dir / *。xml”进行发布时,命令工具会告诉参数列表过长。

The quickest solution would be using a bash script like the following: 最快的解决方案是使用bash脚本,如下所示:

for i in $( ls *.xml); do
    cat $i | curl -X POST -H 'Content-Type: text/xml' -d @- http://localhost:8080/solr/update
    echo item: $i
done

which adds to Solr, using curl, all the xml files within the current directory. 使用curl将当前目录中的所有xml文件添加到Solr。

Otherwise you can write a Java main similar to the one included in post.jar, which adds all the xml files within a directory instead of having to pass all of them as arguments. 否则,您可以编写类似于post.jar中包含的Java主程序,该主程序将所有xml文件添加到目录中,而不必将所有这些XML文件作为参数传递。

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

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