php-显示相关内容的链接 [英] php - display links to related content

查看:108
本文介绍了php-显示相关内容的链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻求实现与"youtube相关的视频"风格相关的内容系统.

I am looking to implement a 'youtube related videos' style related content system.

我的每个页面都有5个标签/关键字,标题和描述.我想显示两个最相似页面的链接.

I have 5 tags/keywords for each of my pages, a title and a description. I would like to display links to the two most similar pages.

我正在猜测一个基于相关性的基于顺序的mysql查询.

I am guessing a mysql query based around order by relevance.

非常感谢.

推荐答案

您可以将标题,描述,关键字分解为标记,然后在mysql中对这些关键字和相关性进行全文搜索.

you can break up the title, description, keywords into tokens and then do a full text search in mysql on those keywords and order by relevance.

select * from article where match(title, description, keywords)
  against ('word1 word2 word3 word4' in boolean mode)
  order by relevance desc

http://dev.mysql.com/doc/refman/5.0/en/fulltext-boolean.html

这篇关于php-显示相关内容的链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆