order - MySQL: Why score is always 1 in Fulltext? -


if run query , print score of each rows, 1:

here sample query results:

first     |  last     | score ------------------------------ jonathan  |  bush     | 1 joshua    |  gilbert  | 1 jon       |  jonas    | 1 

and query run:

select first, last, match(first, last) against ('jon' in boolean mode) score  users  match(first, last) against('jon' in boolean mode) order score desc; 

the boolean mode supports binary answers, means 0 or 1 whether search string appears in column or not. decimal result calculate weight, have use match-against on indexed columns.

you can use boolean mode way wheight either:

select *, ((1.3 * (match(column1) against ('query' in boolean mode))) + (0.6 * (match(column2) against ('query' in boolean mode)))) relevance table ( match(column1,column2) against ('query' in boolean mode) ) order relevance desc 

the advantage of boolean mode can use on non-indexed columns 0,1 result, non-boolean mode returns decimal result can applied on indexed columns... see here.


Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -