问题
Can Apache Solr be used to index all the files of a folder(Parent) and its subfolders, containing files of all types: XML, .json, .pdf,.doc etc..?
回答1:
Using post tool can be done
java -Dc=test -Drecursive -Dauto -jar post.jar folder
-Dauto for all file types that solr can handle
-Dc to specify collection name
-Drecursive to handle if folder has files inside subfolder.
if folder has has subfolder it will index files inside subfolder
回答2:
You need to use a Data Import Handler to achieve that . You can find information about how to implement it here http://wiki.apache.org/solr/DataImportHandler . Data import handler has an option recursive=true that allows you to index files nested in folders .Go through documentation in the link , and you will find a solution for yourself . Hope this helps :) .
回答3:
Latest Solr actually ships with an examples showing how to do that, including a custom interface to play with. The example is located in examples/files and you just need to follow the README.txt instructions.
来源:https://stackoverflow.com/questions/39249343/indexing-in-apache-solr-of-all-files-contained-in-a-folder-and-its-subfolders