Re: keyword searching

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm doing a fulltext search.


CPT John W. Holmes wrote:


From: "Adam Williams" <awilliam@xxxxxxxxxxxxxxxx>

I am selecting a field in a database called description for keyword
searching.  The field contains names of people, states, years, etc.  When
someone searches for say "holmes north carolina" the query searches for
exactly that, fields which have "holmes north carolina", and not fields
that contaim holmes, north, and carolina.  So I run a str_replace to
replace all spaces with *, which turns it into "holmes*north*carolina",
but say that north carolina is before holmes in the field, it won't return
those fields (it only returns fields in which holmes is infront of north
carolina).  So how can I have it return all fields which contain all
the words holmes, north, and carolina in any order, in that field?


Are you doing a fulltext search or just matching a word in a lookup column?

In the case of the latter, you'll have to split up the sentence into
individual words and look for each of them

WHERE column = 'holmes' || column = 'north' || column = 'carolina' ...

---John Holmes...
(not in North Carolina, btw!)


-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux