1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
use *;
/// Extends `search_content` to cover transcripts, and gives every hit a
/// `start_ms` to seek to.
///
/// One function rather than a second entry point, so ranking and paging stay
/// in SQL. Paging two result sets and merging them in the application would
/// give wrong totals and wrong pages.
///
/// Two decisions worth stating:
///
/// - Transcripts get their own `match_tier` (0, below the existing 1 and 2)
/// rather than a lower `score`. A title match says the video is *about* X;
/// a transcript match says X was said somewhere in ninety minutes. Merging
/// them onto one numeric scale would let a lucky phrase in a long
/// transcript outrank a precise title match.
///
/// - `include_transcripts` is a separate parameter from `include_fuzzy`.
/// Fuzzy matching is trigram similarity over titles and has a noise floor;
/// transcript matching is real full-text and is precise. `--no-fuzzy` is a
/// request for precision and should not discard the precise tier with it.
///
/// The previous definition is not inlined into `down`. It is 200 lines of
/// function body, and a second copy of it would silently drift from
/// `sql/0005_search.sql`; the file remains the single source of truth.
;
const UP: &str = include_str!;