开发者

Full text search query build

开发者 https://www.devze.com 2023-01-05 04:47 出处:网络
Iam work on full text search build out. Im having issue on how to check the \'not\' condition. Ex: If the user givegiri and hari as search term ,then i build the searc开发者_如何学Goh terms as giri

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

精彩评论

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