我正在尝试从Solr索引中删除文档。我正在使用pysolr,并尝试通过id和query删除它们。在这两种情况下,操作都会失败,ids如下:cr-10.1002/(sici)1520-6688(199621)15:2<476::aid-pam7>3.3.co;2-2,错误如下:
pysolr.SolrError: Solr responded with an error (HTTP 400): [Reason: Unexpected character '4' (code 52) in content after '<' (malformed start element?). at [row,col {unknown-source}]: [1,53]]
https://lucene.apache.org/core/7_2_1/queryparser/org/apache/lucene/queryparser/classic/package-summary.html#Escaping_Special_Characters根本没有提到转义尖括号。我试过了,但没有成功。
知道我能做些什么来删除这些文档吗?
编辑:更新ID以匹配错误
发布于 2018-08-03 17:22:46
我最终使用的JSON API如下所示:
import requests
url = 'http://localhost:8983/solr/collection/update' # update endpoint of the collection
ids_to_delete = ['a', 'b<c', 'd:e']
requests.post(url, json={ 'delete': ids_to_delete })https://stackoverflow.com/questions/51668522
复制相似问题