hi,
i'm having the following problem that sort of makes my life miserable :-)

i've been working on a search script that could take a query like this:
(car and bus) or apple not (orange and table)....etc.
...basicly any logical statement...and return the right references based on
searching specified fields in the database.

the script so far basicaly breaks down the query and searches specified
fields for words in the query. the result of this search is then stored in a
temporary table where the most important field is always a field f
consisting of all the words from the query that were found in a particular
row of fields in the main database.

so the result could look like this:
ref_id a b......f
1      1 0......car bus orange
2      0 0......car bus
3      1 1......car apple table
4      0 1......apple

now, i need to convert the input query into a sql query that could be used
with mysql. it all works fine if there are no "NOT" logical operators.

for example:
(car and bus) or apple
would convert to

SELECT * FROM T WHERE (((f LIKE "%car%") AND (f LIKE "%bus%")) OR (f LIKE
"%apple%"))

and returns the right results

but when i use NOT.... i can't beleive that one cannot use NOT but has to
use something like "f NOT LIKE...." instead which so much complicates the
whole thing.

does anybody have a short solution to this, before i start working on a
converting mechanism?

remember, that i strive for as simple script possible...so i'm looking for a
way of simply going from

a AND b NOT c

to

f like a AND f like b NOT f like c

...or something in that sence.

thanks a lot for your help.

libor matyas




---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to