Anastasia
Anastasia

Reputation: 31

solr-index from multiple folders

I am trying to make a web search application with solr but I have problems. The problem is that in the example that I followed, all the files are in the same folder. But I want to index files from different directories (ie give the root folder and index all the xml files from all subdirectories). Is that possible?

Upvotes: 1

Views: 894

Answers (2)

nickyd
nickyd

Reputation: 11

Try the SimplePostTool recursive option:

java -Dauto -Drecursive -jar post.jar 

Upvotes: 1

Fermin Silva
Fermin Silva

Reputation: 3377

Try this in a shell script (untested):

#!/bin/sh

FILES=$(find . -iname "*.xml")
URL=http://localhost:8983/solr/update

for f in $FILES; do
  echo "Posting $f"
  curl $URL --data-binary @$f -H 'Content-type:application/xml' 
  echo
done

#send the commit command to make sure all the changes are flushed and visible
curl $URL --data-binary '<commit/>' -H 'Content-type:application/xml'
echo

Place it in the root folder where you have the xml files.

(i assume you have linux and the 'post.sh' script is the example you followed)

Upvotes: 0

Related Questions