【发布时间】:2021-01-13 13:26:56
【问题描述】:
Npgsql docs suggest 使用 ToTsVector 基于 expression index 执行全文搜索
.Where(p => EF.Functions.ToTsVector("english", p.Title + " " + p.Description).Matches("Npgsql"))
据我了解表达式索引,它们要求查询使用与创建索引相同的表达式,即"Name" || ' ' || "Description"。
但是在我看来,p.Title + " " + p.Description 在被转换为 SQL 之前已被评估,因为 ToTsVector 采用纯字符串
public static NpgsqlTsVector ToTsVector(this DbFunctions _, string config, string document);
我错了还是索引不会被使用?如果我是正确的,有没有办法在不使用原始 SQL 的情况下正确查询?
【问题讨论】:
标签: npgsql