If I want to achieve highlight function of Solr in Django with python, how could it be done by using the package solrpy?
How did solrpy deal with it, as the highlighting results live in a absolute fragment on the SolrResponse object,shown as a dictionary of dictionaries.
What's more, does solrpy still work for more function of solr such as faceting, highlighting and stuff, besides basic query
sc = solr.SolrConnection("http://localhost:8080/solr/cases")
response_c=sc.query('name:*%s'%q+'*',fields='name,decision_date', highlight='name')
print(response_c.results)
for hit in response_c.results:
print(hit)
And why above code does not work to achieve Highlighting?
The highlighting information is stored in a separate entry named highlighting
on the response object:
If you pass in `highlight` to the SolrConnection.query call,
then the response object will also have a "highlighting" property,
which will be a dictionary.
That being said, I strongly recommend using pysolr instead of solrpy, as pysolr is maintained by the django-haystack project and has been developed continuously over the last few years compared to solrpy.