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


Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.