Jump to content

Fulltext MATCH with score - only top needed - Help please


dfrojd

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";


Archived

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

×
×
  • Create New...

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.