3 messages in com.mysql.lists.mysqlRe: Fultext search issues| From | Sent On | Attachments |
|---|---|---|
| Yemi Obembe | 30 Mar 2006 08:32 | |
| Gabriel PREDA | 30 Mar 2006 23:24 | |
| Octavian Rasnita | 31 Mar 2006 01:29 |
| Subject: | Re: Fultext search issues![]() |
|---|---|
| From: | Octavian Rasnita (oras...@fcc.ro) |
| Date: | 03/31/2006 01:29:21 AM |
| List: | com.mysql.lists.mysql |
From: "Gabriel PREDA" <gabr...@gmail.com>
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.




