2

我想使用我自己的函数来生成三元向量,用于索引和查询,这可能吗?

它通常是如何工作的:

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 将使用它来生成三元向量,这也可以

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绕过三元组生成步骤相同。

4

0 回答 0