By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,952 Members | 1,937 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,952 IT Pros & Developers. It's quick & easy.

Whole word Search in Postgresql

P: 9
Hi all .... Im working on search function for an app and have built a pretty decent thing go except one thing.

Im using the ~* to match the incoming keywords against several fields, 4 varchar and one text ...... its working BUT Im getting partial words which isnt exactly what I wanted (neat but not right) lets me explain more.

If im searching on the word cat and using this syntax: ~* 'cat' I get back any whole word "cat" PLUS things like "concat" ...... now how do I tell the db that I ONLY want the whole word cat NOT the letters "cat" within another word.

If it was simple text fields it would be easier (I think) but the customer wants to be able to search within all sorts of fields for a given term.

BTW, Im using Postgres 9.x

ANY AND ALL HELP would be very much appreciated!
Oct 13 '12 #1
Share this Question
Share on Google+
1 Reply


Rabbit
Expert Mod 10K+
P: 12,347
It would help to see the code but if you're looking for an exact match, you should use the = operator. Not the regular expression operator.
Oct 14 '12 #2

Post your reply

Sign in to post your reply or Sign up for a free account.