From: "Gabriel PREDA" <[EMAIL PROTECTED]>

You ought to use the *Boolean Full-Text Searches.*
You would then do a:

SELECT title, Comment FROM table_name WHERE MATCH (Comment) AGAINST ('+foo
+bar' IN BOOLEAN MODE);

This way the rows that contain both words have higher relevance... those
that have only one... will have lower relevance.

I thought that using a "+" char before a word will match *only* those
records that contain that word.
(And using "-" before words, will find only those records that don't contain
the specified words.)

And using the words with no special signs before, I thought it will give a
higher precedence to the records which contain more searched words.

And I also thought that the rows are not sorted automaticly when searching
in boolean mode.

So I usually search using:

select id, title, match(body) against('word') as rank from table_name where
match(body) against('word' in boolean mode) order by rank;

The search doesn't work slower (or much slower) because it uses twice the
"match", the search is made in boolean mode so the +, -, *, <, >, ",
characters can be used, and the results are sorted.

But.... is there a better way?

Thanks.



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to