Django full text search using SearchHeadline for multiple fields

86 Views Asked by At

While using django full text search can we use SearchHeadline for mutiple field as of now if only takes one field to annotate headline.

search_vector = SearchVector('title', 'body')
search_query = SearchQuery(search_post)
search_headline = SearchHeadline('body', search_query)
questions = posts.annotate(search=search_vector, rank=SearchRank(search_vector, search_query)).annotate(headline=search_headline).filter(rank__gt=0.0001).order_by('-rank')

I use {{ post.headline|safe}}to view this in my django template.

Is there any way i can use another SearchHeadline where i can headline 'title' field which is used in search vector.

I tried annotate more than 2 times it over rides the previous headline.

Is there any solution which can be implemented?

0

There are 0 best solutions below