简体   繁体   English

如何使用Solr索引单个目录中包含的大量文件?

[英]How to index large number of files contained in a single directory using solr?

I have large number of plain text files in a directory. 我的目录中有大量纯文本文件。 I want to index them using solr. 我想使用solr为它们建立索引。 I used the following command as mentioned in other sources: 我使用了其他来源中提到的以下命令:

java -Dc=test -Drecursive -Dauto -jar post.jar folder

but it indexed 0 files. 但它索引了0个文件。 If I have less files then the following works: 如果文件较少,则可以进行以下工作:

java -Dc=test -Drecursive -Dauto -jar post.jar folder/*

But in case of large number of files I get this error: 但是,如果文件太多,则会出现此错误:

Argument list too long . Argument list too long

Note that I am running the command in ubuntu. 请注意,我正在ubuntu中运行命令。

The command line has the limit on the number of the arguments, which you could check by executing getconf ARG_MAX 命令行对参数数量有限制,您可以通过执行getconf ARG_MAX来检查

So, number of the files is exceeding this limit and this is the reason why you get this error. 因此,文件数超过了此限制,这就是您收到此错误的原因。 You should use xargs to overcome this limit. 您应该使用xargs来克服此限制。

Example of usage is following (you need to adapt this to your command): 以下是用法示例(您需要对此进行调整以适应命令):

find . -name \*xml | xargs java -jar post.jar 

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

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