Pazhani M
Pazhani M

Reputation: 1

Solr Server Posting Error

How to post 5000 files to Solr server? While posting by using command "java -jar post.jar dir/*.xml", command tool tells Argument list is too long.

Upvotes: 0

Views: 371

Answers (1)

javanna
javanna

Reputation: 60195

The quickest solution would be using a bash script like the following:

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.

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.

Upvotes: 3

Related Questions