开发者

Full text search query build

Iam work on full text search build out.

Im having issue on how to check the 'not' condition.

Ex:

If the user give giri and hari as search term ,then i build the searc开发者_如何学Goh terms as giri & hari and perform search.

If the user give giri not hari as search term ,then how should i build the search term.

Thanks


Match both: giri & hari, match first not second: giri & !hari

SELECT
    *
FROM
    tablename
WHERE
    to_tsvector(colname) @@ (to_tsquery('giri') && to_tsquery('!hari'));
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜