MySQL Forums
Forum List  »  Full-Text Search

Different score to different columns?
Posted by: Elli
Date: December 27, 2006 08:03PM

Hi,
Is there a way to define full text search index on two columns, but one column gets higher score?

Lets say the table has two columns, 'tags' and 'description'

If I search on 'water', than rows that have water in the 'tags' column will be returned before rows that have water in the 'description' column.

I think it is possible to define in the query two MATCH statements and write a formula on the score of each, and then order by it. Something like:

SELECT ... (MATCH(tags) AGAINST('water')) * 10 + (MATCH(description) AGAINST('water')) AS RANK
WHERE MATCH(tags, description) AGAINST('water')
ORDER BY RANK

I am afraid this will be slow.

Is there a way to solve that in the index definition? For example, does the order of the columns in the index matter?

FULLTEXT(tags, description)
FULLTEXT(description, tags)

Are those same?

Options: Reply• Quote


Subject
Views
Written By
Posted
Different score to different columns?
4108
December 27, 2006 08:03PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.