Hi all,
I am trying to output the highlighted search-term from a Solr search. I'm using Django 1.8.4 with Scorched.
I have already activated highlighting (resp = ('highlighting', self.solr_response.highlighting)) to the search-view, and my json output from a search is:
"highlighting": {
"f0109b89-4882-44cc-90b2-6a51561d14ee": { }, <!-- nothing here, though the result comes up
"73bc1fe4-2c4a-4036-9373-242811e3e7d9": { },<!-- nothing here, though the result comes up
"b7e7a44a-57c4-4378-94fc-273229b0ac7f":
{
"some_field":
[
"Bla bla bla, <em>highlighted search-term</em> bla bla bla..." <!-- highlighted search term
]
},
)
The problem is that I cannot find the way how to tell the Django template system to access that some_field, since it's under content.highlighting (and its id is under
result.id). Of course content.highlighting.result.id.some_field doesn't work - is there a way of concatenating something like {{ content.highlighting}} + {{
result.id }}, so that I can output the highlighted string in the template together with the other corresponding result's fields?
Thanks,
Luca