2010-06-25 7 views
0

Iam travail sur la recherche en texte intégral construire.Recherche plein texte recherche

Im ayant un problème sur la façon de vérifier la condition «non».

Ex:

Si l'utilisateur donne Giri et hari comme terme de recherche, puis-je construire les termes de recherche comme Giri & hari et effectuer la recherche.

Si l'utilisateur donne giri pas hari comme terme de recherche, alors comment dois-je construire le terme de recherche.

Merci

+0

Avez-vous lu le [bien] (http://www.postgresql.org/docs /current/static/textsearch-controls.html#TEXTSEARCH-PARSING-QUERIES) [manuel] (http://www.postgresql.org/docs/current/static/datatype-textsearch.html#DATATYPE-TSQUERY)? –

Répondre

0

match à la fois: Giri & hari, premier match pas seconde: Giri & hari

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