【发布时间】:2017-04-20 09:58:06
【问题描述】:
以下 python 代码添加了一个文档,但没有 json 内容:
solr_instance = pysolr.Solr('http://192.168.45.153:8983/solr/test', timeout=60)
json_filename = '/path/to/file/test.json'
argws = {
'commit': 'true',
'extractOnly': False,
'Content-Type': 'application/json',
}
with open(json_filename, 'rb') as f:
solr_instance.extract(f, **argws)
solr_instance.commit()
在命令行中使用curl 可以正常工作:
$ curl 'http://192.168.45.153:8983/solr/test/update?commit=true' \
--data-binary @/path/to/file/test.json \
-H 'Content-Type: application/json'
文件有以下内容:
$ cat /cygdrive/w/mist/test.json
--> [{"x": "a","y": "b"}]
我正在使用pysolr 3.6.0 和solr 6.5.0
【问题讨论】: