Python 在不使用网络的情况下将文档上载到solr?
我需要能够加快上传到solr索引的速度。 在python中,我使用以下内容:Python 在不使用网络的情况下将文档上载到solr?,python,solr,Python,Solr,我需要能够加快上传到solr索引的速度。 在python中,我使用以下内容: for f in files: cmd = ('curl', '-s', \ 'http://localhost:8983/solr/core/update/json?commit=true', \ '--data-binary', '@' + f, '-H', 'Content-type:application/json') call(cmd) 我有很多这样的文件需要
for f in files:
cmd = ('curl', '-s', \
'http://localhost:8983/solr/core/update/json?commit=true', \
'--data-binary', '@' + f, '-H', 'Content-type:application/json')
call(cmd)
我有很多这样的文件需要输入到这个索引中,速度非常慢
我熟悉命令行中使用的post工具:
bin/post -c gettingstarted example/films/films.json
我考虑过使用系统调用,但是文档提到这个命令行方法通过localhost:8983与服务器联系。我假设我不会用这种方法避免任何网络延迟,尽管我还没有尝试过
在我的python脚本中有没有更快的方法来实现这一点?localhost连接应该很少甚至没有网络延迟,因为它实际上不会影响网络。如果事情进展缓慢,那可能是因为solr进展缓慢。啊,这是一个很好的观点。我想这可能是我必须解决的一个瓶颈。我仍然要测试系统调用,看看是否有任何区别。