﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
31147	Add support for ts_headline	Hannes Ljungberg	Hannes Ljungberg	"It would be nice to get support for the Postgres full text search function `ts_headline`. See https://www.postgresql.org/docs/current/textsearch-controls.html#TEXTSEARCH-HEADLINE

`SearchHeadline` would also accept an optional `options` argument  which is a where configuration options like `StartSel` and `StopSel` can be specified.

My proposed implementation work look like this:

{{{#!python
>>> from django.contrib.postgres.search import SearchHeadline, SearchQuery
>>> query = SearchQuery('brave sir robin')
>>> first_line = Line.objects.annotate(
...     headline=SearchHeadline('dialogue', query, options={
...         'StartSel': '<b>',
...         'StopSel': '</b>'
...     })
... ).first()
>>> print(first_line.headline)
'<b>Robin</b>. He was not at all afraid to be killed in nasty ways. <b>Brave</b>, <b>brave</b>, <b>brave</b>, <b>brave</b> <b>Sir</b> <b>Robin</b>'
}}}

I have this implementation ready if this would be accepted: https://github.com/django/django/compare/master...hannseman:ts_headline?expand=1
"	New feature	closed	contrib.postgres	dev	Normal	fixed	postgres search ts_headline		Ready for checkin	1	0	0	0	0	0
