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
use *;
/// Makes fuzzy title matching match whole words instead of fragments.
///
/// The gate was `word_similarity(query, title) > 0.3`, and 0.3 turned out to be
/// exactly the floor rather than above it: for the query `podracing` every
/// title containing the word "Podcast" scores precisely 0.300, because "pod" is
/// the query's first trigram. On 8,748 harvested videos that admitted 737
/// results — 31 pages of a podcast back catalogue — for a query whose two real
/// answers were rows 1 and 2 of page 1.
///
/// `strict_word_similarity` only considers extents bounded by non-word
/// characters, so the same query drops to 23 hits, and a genuine typo is
/// unaffected: `spder man` against "Blood Pact: Spider-Man (Pt. 1)" scores
/// 0.615 under either scorer, because a typo is a whole-word difference rather
/// than a fragment of one.
///
/// The threshold is left to `pg_trgm.strict_word_similarity_threshold` rather
/// than written into the query, because `<%` is indexable only when the
/// threshold comes from the GUC — which is also what makes the GIN trigram index
/// usable here, something the raw function call never was.
;
const UP: &str = include_str!;