Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/291.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何将子文档添加到Solr上现有的父结构中?_Python_Json_Solr_Parent Child_Pysolr - Fatal编程技术网

Python 如何将子文档添加到Solr上现有的父结构中?

Python 如何将子文档添加到Solr上现有的父结构中?,python,json,solr,parent-child,pysolr,Python,Json,Solr,Parent Child,Pysolr,我正在使用Pysolr为以下结构编制索引。已成功为其编制索引 l = [{'id': 1, 'name': 'John Smith', 'type': 'person', '_childDocuments_': [{'id': 'text1', 'language': 'nl', 'text': ' John Smith has worked on many projects for the company'}]}] 我只想为另外一个子文档编制索引,以获得Sol

我正在使用Pysolr为以下结构编制索引。已成功为其编制索引

l = [{'id': 1,
  'name': 'John Smith',
  'type': 'person',
  '_childDocuments_': [{'id': 'text1',
    'language': 'nl',
    'text': ' John Smith has worked on many projects for the company'}]}]  
我只想为另外一个子文档编制索引,以获得Solr中的以下结构:

[{'id': 1,
  'name': 'John Smith',
  'type': 'person',
  '_childDocuments_': [{'id': 'text1',
    'language': 'en',
    'text': ' John Smith has worked on many projects for the company'}, 
     {'id': 'text2', 'language': 'en', 'text': 'The one in charge for this is John Smith'}]}]
我的代码用于索引上面显示的第一个结构:

solr = pysolr.Solr('http://localhost:8983/solr/core_example', always_commit=True)

solr.add(l) 

我不认为有任何人支持这样做-看到了吗