<html><body><div style="color:; background-color:; font-family:MS PGothic, sans-serif;font-size:12pt"><div style="font-family: &quot;MS PGothic&quot;, sans-serif; font-size: 12pt;">MLみなさん</div><div style="font-family: &quot;MS PGothic&quot;, sans-serif; font-size: 12pt;">こんにちは。</div><div style="font-family: &quot;MS PGothic&quot;, sans-serif; font-size: 12pt;"><br></div><div style="font-family: &quot;MS PGothic&quot;, sans-serif; font-size: 12pt;">1っか月+にまたpgroonga試して見ました。</div><div style="font-family: &quot;MS PGothic&quot;, sans-serif; font-size: 12pt;">二つ単語検索のOR条件に&amp;@~オペレーター使おうとしていますが、エラーになります。</div><div style="font-family: &quot;MS PGothic&quot;, sans-serif; font-size: 12pt;"><br></div><div style="font-family: &quot;MS PGothic&quot;, sans-serif; font-size: 12pt;">エラー:</div><div style="font-family: &quot;MS PGothic&quot;,
 sans-serif; font-size: 12pt;"><span style="color: rgb(52, 61, 68); font-family: segoe-ui, open-sans, tahoma, arial; font-size: 15px;">Undefined function: 7 ERROR: operator does not exist: text &amp;@~ unknown LINE 3: ... WHERE target_col &amp;@~ $1 OR ... ^ HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.'</span><br></div><div style="font-family: &quot;MS PGothic&quot;, sans-serif; font-size: 12pt;"><span style="color: rgb(52, 61, 68); font-family: segoe-ui, open-sans, tahoma, arial; font-size: 15px;"><br></span></div><div style="font-family: &quot;MS PGothic&quot;, sans-serif; font-size: 12pt;"><span style="color: rgb(52, 61, 68); font-family: segoe-ui, open-sans, tahoma, arial; font-size: 15px;">実行したSQL:</span></div><div style="font-family: &quot;MS PGothic&quot;, sans-serif; font-size: 12pt;"><span style="color: rgb(52, 61, 68); font-family: segoe-ui, open-sans, tahoma, arial;
 font-size: 15px;">$stmt = $pdo-&gt;prepare("SELECT 項目1、... FROM db名 WHERE target_col</span><span style="color: rgb(52, 61, 68); font-family: segoe-ui, open-sans, tahoma, arial; font-size: 15px;">&nbsp;&amp;@~ :keyword1 OR :keyword2");</span><br></div><div style=""><span><div style="color: rgb(52, 61, 68); font-family: segoe-ui, open-sans, tahoma, arial; font-size: 15px;">$stmt-&gt;bindValue(':keyword1', '東京');<br></div><div style="color: rgb(52, 61, 68); font-family: segoe-ui, open-sans, tahoma, arial; font-size: 15px;">$stmt-&gt;bindValue(':keyword2', '大阪');<br></div><div style=""><span style="color: rgb(52, 61, 68); font-family: segoe-ui, open-sans, tahoma, arial; font-size: 15px;">$stmt-&gt;execute();</span><br></div><div style=""><span style="color: rgb(52, 61, 68); font-family: segoe-ui, open-sans, tahoma, arial; font-size: 15px;"><br></span></div><div style=""><span style="color: rgb(52, 61, 68); font-family: segoe-ui, open-sans,
 tahoma, arial; font-size: 15px;">例) target_col列の'東京'又は'大阪'をヒットさせて、一覧取得しようとしています。</span></div><div style=""><span style="color: rgb(52, 61, 68); font-family: segoe-ui, open-sans, tahoma, arial; font-size: 15px;"><br></span></div><div style=""><span><span style="color: rgb(52, 61, 68); font-family: segoe-ui, open-sans, tahoma, arial; font-size: 15px;">https://pgroonga.github.io/reference/operators/query-v2.htmlの「Operator classes」のところ:</span><br></span></div><div style=""><span style="color: rgb(51, 51, 51); font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 14px;">You need to specify one of the following operator classes to use this
 operator:と書いていますが、Usageのところにどうやってspecifyするのか、例がないのでこの以降どうすればよいのか、わかりません。前のバージョン(@@オペレーター)の時は検索出来ていました。</span></div><div style=""><span style="color: rgb(51, 51, 51); font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 14px;"><br></span></div><div style=""><span style="color: rgb(51, 51, 51); font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 14px;">上記の例で、target_colの型は「text」で、そのフィールドのindexを作っています。</span></div><div style=""><span style="color: rgb(51, 51, 51); font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 14px;">(CREATE INDEX <span style="color: rgb(52, 61, 68); font-family: segoe-ui, open-sans, tahoma, arial; font-size:
 15px;">target_col&nbsp;</span>_index ON db名 USING pgroonga (<span style="color: rgb(52, 61, 68); font-family: segoe-ui, open-sans, tahoma, arial; font-size: 15px;">target_col&nbsp;</span>);)</span></div><div style=""><br></div><div style="">yum updateしてpgroongaの最新ライブラリーは入れています。</div><div style="">CentOS log:</div><div style=""><div><span style="color: rgb(52, 61, 68); font-family: segoe-ui, open-sans, tahoma, arial; font-size: 15px;">&gt;Updated:</span></div><div><span style="color: rgb(52, 61, 68); font-family: segoe-ui, open-sans, tahoma, arial; font-size: 15px;">&nbsp;&gt;groonga-libs.x86_64 0:7.0.5-1.el6 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
 &nbsp; &nbsp;</span></div><div><span style="color: rgb(52, 61, 68); font-family: segoe-ui, open-sans, tahoma, arial; font-size: 15px;">&gt;</span><span style="color: rgb(52, 61, 68); font-family: segoe-ui, open-sans, tahoma, arial; font-size: 15px;">Complete!</span></div><div><span style="color: rgb(52, 61, 68); font-family: segoe-ui, open-sans, tahoma, arial; font-size: 15px;"><br></span></div><div><span style="color: rgb(52, 61, 68); font-family: segoe-ui, open-sans, tahoma, arial; font-size: 15px;">上記作業はPHP/PDOで実行していますが、PhpPgAdmin使って直接SQL文実行しても結果は同じです。</span></div></div><div style="">(実行した文:<span style="color: rgb(52, 61, 68); font-family: segoe-ui, open-sans, tahoma, arial; font-size: 15px;">SELECT 項目1、... FROM db名 WHERE target_col</span><span style="color: rgb(52, 61, 68); font-family: segoe-ui, open-sans, tahoma, arial; font-size: 15px;">&nbsp;&amp;@~
 ’東京’ OR ’大阪</span><span style="color: rgb(52, 61, 68); font-family: segoe-ui, open-sans, tahoma, arial; font-size: 15px;">’;)</span></div><div style=""><span style="color: rgb(52, 61, 68); font-family: segoe-ui, open-sans, tahoma, arial; font-size: 15px;"><br></span></div><div style="">解決策ご存知の方、ご教授お願いします。</div></span></div></div></body></html>