tags:

views:

22

answers:

1

Hi,

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 search 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

A: 

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

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