From 7673c900aed824ec3571021924da5fbe694f9885 Mon Sep 17 00:00:00 2001
From: HeNine <>
Date: Wed, 17 Nov 2021 13:47:39 +0100
Subject: [PATCH] search optimization 6: aaaaaaaa
---
buscribe-api/buscribeapi/buscribeapi.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/buscribe-api/buscribeapi/buscribeapi.py b/buscribe-api/buscribeapi/buscribeapi.py
index 84b4c40..c82f41c 100644
--- a/buscribe-api/buscribeapi/buscribeapi.py
+++ b/buscribe-api/buscribeapi/buscribeapi.py
@@ -168,6 +168,8 @@ def fetch_lines(db_conn, start_time, end_time, ts_query=None, limit=None, offset
transcription_line,
ts_rank_cd(coalesce(to_tsvector('english', transcription_line), ''::tsvector) ||
coalesce(to_tsvector(array_to_string(names, ' ')), ''::tsvector), (SELECT * FROM q)) AS rank,
+ ts_headline(transcription_line,
+ (SELECT * FROM q), 'StartSel='''', StopSel=') AS highlighted_text,
transcription_json
FROM buscribe_transcriptions
LEFT OUTER JOIN (SELECT line, array_agg(name) AS names
@@ -192,6 +194,8 @@ def fetch_lines(db_conn, start_time, end_time, ts_query=None, limit=None, offset
''::tsvector) ||
coalesce(setweight(to_tsvector(array_to_string(names, ' ')), 'C'), ''::tsvector),
(SELECT * FROM q)) AS rank,
+ ts_headline(coalesce(verifications.verified_line, buscribe_transcriptions.transcription_line),
+ (SELECT * FROM q), 'StartSel='''', StopSel=') AS highlighted_text,
null AS transcription_json
FROM buscribe_transcriptions
INNER JOIN (