Jump to content

Archived

This topic is now archived and is closed to further replies.

dfrojd

Fulltext MATCH with score - only top needed - Help please

Recommended Posts

HI, I am using a Fulltext query with rank as described in:

[dev.mysql.com]

with score to list most relevant hits for a php project.

Now using a large database with 7000 entries and a long "against" String I am returned too many results with scores ranging fro ~6.xxx to 0.00xxx.

Could someone please explain how to modify my query so that only results with a relevance (score) greater than 1 are returned.

My Query now is:
---------------------------
$against = "Hotel City Cityreise Cityreisen St├Ądtereise St├Ądtereisen";

$query = "SELECT DISTINCT obj_lfd, obj_bez, obj_krz, obj_img_path_01,";
$query .= "MATCH (";

$query .= "obj_bez, ";
$query .= "obj_krz, ";
$query .= "obj_region_text, ";
$query .= "obj_ort, ";
$query .= "obj_detail, ";
$query .= "obj_freizeit, ";
$query .= "obj_sonst, ";
$query .= "obj_ort_info, ";
$query .= "obj_anreise_info, ";
$query .= "obj_add_desc_01, ";
$query .= "obj_cont_desc_01, ";
$query .= "obj_add_desc_02, ";
$query .= "obj_cont_desc_02, ";
$query .= "obj_add_desc_03, ";
$query .= "obj_cont_desc_03, ";
$query .= "obj_img_desc_01 ";

$query .= ") AGAINST ('";
$query .= $against;
$query .= "') as score ";

$query .= "FROM objekte WHERE MATCH ";
$query .= "( ";

$query .= "obj_bez, ";
$query .= "obj_krz, ";
$query .= "obj_region_text, ";
$query .= "obj_ort, ";
$query .= "obj_detail, ";
$query .= "obj_freizeit, ";
$query .= "obj_sonst, ";
$query .= "obj_ort_info, ";
$query .= "obj_anreise_info, ";
$query .= "obj_add_desc_01, ";
$query .= "obj_cont_desc_01, ";
$query .= "obj_add_desc_02, ";
$query .= "obj_cont_desc_02, ";
$query .= "obj_add_desc_03, ";
$query .= "obj_cont_desc_03, ";
$query .= "obj_img_desc_01 ";

$query .= ") AGAINST ('";
$query .= $against;
$query .= "')";
$query .= " limit $Anfangsposition, $Zeilen_pro_Seite";


Share this post


Link to post
Share on other sites
[code]
$query .= ") AGAINST ('";
$query .= $against;
$query .= "')";

$query .= " > 1 ";

$query .= " limit $Anfangsposition, $Zeilen_pro_Seite";
[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.