Jump to content
php.lv forumi

Mysql match, kārtot pēc lielākajām sakritībām


Wuu

Recommended Posts

 	$packet = (explode(',',$uRead['description']));
 	$result = mysql_query('select t1.tid,t1.title,t1.description,t2.post from '.$INFO['sql_tbl_prefix'].'topics t1 join '.$INFO['sql_tbl_prefix'].'posts t2 on (t1.tid = t2.topic_id) where t1.forum_id in ('.$uSet['topic_read_forums'].',57) && match(t1.description) against("'. implode('" "',$packet) .'" IN BOOLEAN MODE) ORDER BY t1.tid DESC limit 10;');

 

Es nekādīgi nevaru iebraukt kā kārtot pēc lielāko vārdu sakritības.

 

1054: Unknown column 'relevance' in 'order clause' 

 

Relevance nestrādā.

Link to comment
Share on other sites

Pārmēģināju tur visu, nu nekādīgi nevar piedabūt lai kārto pēc lielākās saderības. Meklēt meklē, bet ka vajag kārtot tā nekas nestrādā.

 

EDIT: Sanāca, kādā web lapelē atradu gatavu search scriptu un no turienes izkodu.

 

 	$packet = (explode(",",$uRead['description']));
 	$result = mysql_query('select t1.tid,t1.title,t1.description,t2.post, MATCH (t1.description) AGAINST ("'. implode('" "',$packet) .'" IN BOOLEAN MODE) AS score from '.$INFO['sql_tbl_prefix'].'topics t1 join '.$INFO['sql_tbl_prefix'].'posts t2 on (t1.tid = t2.topic_id) WHERE MATCH (t1.description) AGAINST ("+'. implode('" "+',$packet) .'" IN BOOLEAN MODE) && t1.forum_id in ('.$uSet['topic_read_forums'].',57) ORDER BY score DESC limit 10;');

Edited by Wuu
Link to comment
Share on other sites

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.   Paste as plain text instead

  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.

Loading...
×
×
  • Create New...