|
|
@ -105,15 +105,15 @@ def fetch_lines(db_conn, start_time, end_time, ts_query=None, limit=None, offset
|
|
|
|
query += "AND transcription_line_ts @@ " \
|
|
|
|
query += "AND transcription_line_ts @@ " \
|
|
|
|
"(CASE WHEN websearch_to_tsquery(%(text_query)s)::text != '' THEN websearch_to_tsquery(%(text_query)s)::text || ':*' ELSE '' END)::tsquery " \
|
|
|
|
"(CASE WHEN websearch_to_tsquery(%(text_query)s)::text != '' THEN websearch_to_tsquery(%(text_query)s)::text || ':*' ELSE '' END)::tsquery " \
|
|
|
|
"ORDER BY ts_rank_cd(transcription_line_ts, (CASE WHEN websearch_to_tsquery(%(text_query)s)::text != '' THEN websearch_to_tsquery(%(text_query)s)::text || ':*' ELSE '' END)::tsquery) DESC, " \
|
|
|
|
"ORDER BY ts_rank_cd(transcription_line_ts, (CASE WHEN websearch_to_tsquery(%(text_query)s)::text != '' THEN websearch_to_tsquery(%(text_query)s)::text || ':*' ELSE '' END)::tsquery) DESC, " \
|
|
|
|
"start_time"
|
|
|
|
"start_time "
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
query += "ORDER BY start_time"
|
|
|
|
query += "ORDER BY start_time "
|
|
|
|
|
|
|
|
|
|
|
|
if limit is not None:
|
|
|
|
if limit is not None:
|
|
|
|
query += "LIMIT %(limit)s"
|
|
|
|
query += "LIMIT %(limit)s "
|
|
|
|
|
|
|
|
|
|
|
|
if offset is not None:
|
|
|
|
if offset is not None:
|
|
|
|
query += "OFFSET %(limit)s"
|
|
|
|
query += "OFFSET %(limit)s "
|
|
|
|
|
|
|
|
|
|
|
|
query += ";"
|
|
|
|
query += ";"
|
|
|
|
|
|
|
|
|
|
|
|