Hello Matthew,

I posted this earlier today but maybe you didnt get the message.
This definitely works for me, and its definitely an AND search (example):

SELECT author, title, year, recommend, copy, publ_desc, publ_loc, 
CEILING(IF(MATCH author AGAINST ( 'Adams') > 0, IF(MATCH title AGAINST 
('Places') > 0, IF(MATCH publ_desc AGAINST ('Society') > 0, (MATCH author 
AGAINST ('Adams') + MATCH title AGAINST ('Places') + MATCH publ_desc 
AGAINST ('Society')), 0), 0), 0)) as x FROM books, publ WHERE publ_id = 
pub_id ORDER BY x DESC

Its messy and you will need to split the words if you only use 1 entry 
field (I use 3 different ones).
But that shouldnt be a problem in php with explode function (even for 
whitespaces).
You then need a function to create the seperate parts according to the 
number of
the words. Even this example select query is only from a test file, my 
original file
sets the whole query together in a php process.
"as x" will give only more than 0% if all three words apply.
So you only need a function in your script reading out the rows with x > 0.

See also the IF() section in the mysql manual...thats how I came up with 
this query.

Hope this helps

Cheers, Nessi



At 17:08 27/06/01 , you wrote:
>  --- Colin Faber <[EMAIL PROTECTED]> wrote:
> > Ok,
> >
> > The message set that I noticed this morning sparked my interest in this.
> >
> > Currently I'm developing a search engine that will utilize mysql's
> > fulltext match technology. The problem that i've run into is, I can't
> > seem to find any documentation on how to force an AND search with in
> > MATCH AGAINST syntax, As far as I can tell this is `OR' only. Has is
> > there
> > an option to force AND?
>
>Sadly not. I've had the same trouble as you with this. It's mentioned
>somewhere
>(http://www.mysql.com/doc/F/u/Fulltext_Features_to_Appear_in_MySQL_4.0.html)
>that this will be in v4; until then, no chance.
>
>The way I do this is to split queries into words and do AND.
>
>So to find charles dickens:
>
>SELECT * FROM BOOK WHERE MATCH author AGAINST ('charles') AND MATCH author
>AGAINST ('dickens')
>
>If anyone knows how to make 'charles dickens' match simply fields
>containing both those words, rather than one or the other (ordering by
>score helps, but still the last results would be irrelevant), please
>enlighten me.
>
>=====
>
>
>____________________________________________________________
>Do You Yahoo!?
>Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
>or your free @yahoo.ie address at http://mail.yahoo.ie
>
>---------------------------------------------------------------------
>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


---------------------------------------------------------------------
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