Mysql MATCH AGAINST question

Discussion in 'MySQL' started by Hjalle, May 9, 2007.

  1. #1
    If I have a mysql query thats looks something like :
    Select * from table MATCH (`column1`, `column2`, `column3`) AGAINST ('somewords') AS Relevance

    How can I make one of the columns relevance count higher then the others? Like column1 should give twice the amount of relevance as column2?

    I hope you get my point!

    Thank you!
     
    Hjalle, May 9, 2007 IP
  2. wing

    wing Active Member

    Messages:
    210
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    58
    #2
    How about something like this...

    select *, ( (1.2 * (match(column1) against ('+somewords' in boolean mode)))+
    (0.6 * (match(column2) against ('+somewords' in boolean mode))) +
    (0.2 * (match(column2) against ('+somewords' in boolean mode))) )
    as relevance from [table] where ( match(column1,column2,column3)
    against ('+somewords' in boolean mode) ) having relevance > 0 order by relevance desc;
    Code (markup):
    Adding most weight to column 1, less to column 2 etc...
     
    wing, May 12, 2007 IP
  3. Hjalle

    Hjalle Peon

    Messages:
    117
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Yeah I actually found a similar thing.. Thank you

    The problem is though the increased querytime I received.. A query could take up to 30-40 seconds, and thats not that good:D

    Will the problem get solved if I make one index for each column and not one index with all three columns?
     
    Hjalle, May 13, 2007 IP