我想使用自己的函数生成trigram向量,对于索引和查询,是否可能?
通常如何运作:
indexing : text => pg_text_to_trigram_vector => submit vector to index
querying : query => pg_text_to_trigram_vector => query using vector
我想绕过pg_text_to_trigram_vector
步骤并将我自己的不同生成的三元组向量提交到索引和查询
indexing : my-own-trigram-vector => submit my-vector to index
querying : my-own-trigram-vector => query using my-vector
或者我可以定义自己的函数,PostgreSQL会使用它来生成trigram向量,也可以 没问题
indexing : text => my-own-function => submit my-vector to index
querying : query => my-own-function => query using my-vector
这可能吗?
示例:
我想向索引
提交3个向量['abc', 'cbd', 'def']
['abc']
['sdd', 'dd3', '5gd', 'd4d']
然后用其他向量查询
['abc', 'cbd']
基本上它与pg_trgm
相同,但绕过了三元组生成步骤。