fulltext mysql search formatting and preg_replace question
| From: | daniel at electroteque dot org | Date: | Mon, 02 Jun 2003 23:32:42 +0000 |
| Subject: | fulltext mysql search formatting and preg_replace question | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-149855@lists.php.net to get a copy of this message | ||
hi there i am creating a fulltext mysql search engine, i am generating the
sql query from form inputs , within a fulltext text field , i can input
exact matches like so "something1 something2" "something3 something4" ,
although there is a problem with this , the server defaults space between
words to OR , althought he user may require AND so the syntax is like
"something1 something2"+"something3 something4" or even
+"something1 something2" +"something3 something4"
this isnt really user friendly , i was wondering what the best way to
format this to a friendly search syntax , maybe like this
"something1 something2" AND "something3 something4" or even
"something1 something2" OR "something3 something4"
and formats it like
+"something1 something2" +"something3 something4" if there is an AND
statement
or
"something1 something2" "something3 something4" if its OR
where AND/OR are in a select menu , i'm trying to format all text
with "something" around them using preg_replace so it should be +"something"
any ideas ?