1. 程式人生 > >python操作solr查詢

python操作solr查詢

name="冰 雨"
singers="劉 德華"
solr = pysolr.Solr('http://10.xxx.xxx.xxx:8081/solr/music_app_song_new', timeout=10)
results = solr.search('songNeatName_qp:"%s" AND singerNames_qp:"%s"' % (name,singers) , ** {'wt': 'json','fl': 'id,hotLevel,isCopyright',})

print(results)
print(len(results))
isCopyright=results.docs[0]["isCopyright"]
print(isCopyright)