List:General Discussion« Previous MessageNext Message »
From:Martin Edelius Date:July 9 1999 1:43pm
Subject:SV: Free text searches using MySQL
View as plain text  
I've been looking for a solution to this as well but my problem is also
how convert logical keywords from the search criteria into a a proper
SQL query.

One site I'm admin for has a plain TEXT column for their news posts. I'd
like for our readers to be able to use AND, OR and NOT in the search
criteria when searching through the news but I have no idea on how to
parse the criteria into a working SQL query. A regexp perhaps...?

If a users for instance enters "intel OR alpha AND linux" I would like
this to become "select * from news where \"intel\" in post or \"alpha\"
in post and \"linux\" in post;" (where post is the TEXT field containing
the actual news item). I'm probably way off with this query but that's
part of what I need help with. 8) If I know how the query have to look
like I might be able to write the PHP3 code to convert the given search
criteria to a query.

I'm also intersted in how to design the DB as well although I can't
start from scratch, I'd have to add columns and/or indexes to my DB...
8/


Best regards,
Martin Edelius

Spirex Digital Design

--------------------------------
www: http://www.spirex.se
Mail: martin.edelius@stripped
Phone: +46-31-514651, 0708-113711
Fax: +46-31-514331
S-422 43 Hisings Backa
--------------------------------



Thread
SV: Free text searches using MySQLMartin Edelius9 Jul