I need to make search-as-you-type autocomplete for a large list of companies (over 80,000,000). The company name should contain the word that starts with a search query like this
+-------+----------------------------------+
| term | results |
+-------+----------------------------------+
| gen | general motors; general electric |
| geno | genoptix; genomic health |
| genom | genoma group; genomic health |
+-------+----------------------------------+
The pg_trgm module and GIN index implement similar behavior but don't solve my problem.
For example, ElasticSearch has feature Edge NGram Tokenizer that completely fits my requirements.
From documentation:
The edge_ngram tokenizer first breaks the text down into words
whenever it encounters one of a list of specified characters,
then it emits N-grams of each word
where the start of the N-gram is anchored to the beginning of the word.
Edge N-Grams are useful for search-as-you-type queries.
Is there a similar solution in PostgreSQL?