如何在 PDO 中使用 to_tsquery (postgres)?
How to use to_tsquery (postgres) in PDO?
我尝试使用像
这样的全文搜索
$STM = $PDO->prepare('SELECT title FROM zz_ad.advs WHERE to_tsvector(title) @@ to_tsquery(:str)');
$STM->execute(['str' => 'Hi!']);
$STM->fetchAll();
结果我有:错误:tsquery 中的语法错误:"Hi!"
如果我尝试不使用“!”它的工作!
A tsquery value stores lexemes that are to be searched for, and combines them honoring the Boolean operators & (AND), | (OR), and ! (NOT). Parentheses can be used to enforce grouping of the operators.
'Hi!' 不是有效的词位。 'Hi' 是。
我尝试使用像
这样的全文搜索$STM = $PDO->prepare('SELECT title FROM zz_ad.advs WHERE to_tsvector(title) @@ to_tsquery(:str)');
$STM->execute(['str' => 'Hi!']);
$STM->fetchAll();
结果我有:错误:tsquery 中的语法错误:"Hi!"
如果我尝试不使用“!”它的工作!
A tsquery value stores lexemes that are to be searched for, and combines them honoring the Boolean operators & (AND), | (OR), and ! (NOT). Parentheses can be used to enforce grouping of the operators.
'Hi!' 不是有效的词位。 'Hi' 是。