Write template tag.
понедельник, 5 октября 2015 г., 13:54:29 UTC+3 пользователь Luca Guariento
написал:
>
> 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
>
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/e9cdff05-5f2a-4d38-925e-ad3d227913b8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.