LIKE '%text%' and CONTAINING cannot use a B-tree index, so Firebird reads every row. In this short video we show how NGRAM indexes solve this: how sparse n-grams work, how fast the search becomes (up to 3000× faster for a rare word), and what the index costs in disk space and write speed. At the end, we compare it with the IBSurgeon Full Text Search UDR (Lucene++).
More details about N-Gram indexes here.