我需要为大量公司(超过 80,000,000 家)进行搜索时自动完成。公司名称应包含以这样的搜索查询开头的单词
+-------+----------------------------------+
| term | results |
+-------+----------------------------------+
| gen | general motors; general electric |
| geno | genoptix; genomic health |
| genom | genoma group; genomic health |
+-------+----------------------------------+
pg_trgm模块和GIN 索引实现了类似的行为,但不能解决我的问题。
例如,ElasticSearch 具有完全符合我要求的Edge NGram Tokenizer功能。
从文档:
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.
PostgreSQL中是否有类似的解决方案?