dtnwm4807 2011-01-21 09:33
浏览 15
已采纳

按标签搜索域名?

I do have 100k domains with with their related tags.

I want search domains by their tags. for example google.com domain is with search,google,searchengine,engine,web,reference tags

bing.com also with search,bing,searchengine,engine,web like this I have upto 100k domains with their related tags.

Criteria 1

If I search with tags say search,google,searchengine,engine,web,reference then the both domains google.com and bing.com should display in final result.

Criteria 2

If I search with tags search,searchengine,engine,web then also both domains google.com and bing.com should appear in results

Criteria 3

If I search with tags search,searchengine then also both domains should be displayed.

Criteria 4

If only tag search then also both domains need to be display.

Criteria 5

How do I prioritize result with its tag say if I search with tags search,google,searchengine,engine,web,reference then google.com should come first and bing.com come second

Finally to achieve all these results how should I design my table and how I should query to table?

Thanks

  • 写回答

1条回答 默认 最新

  • duanci6484 2011-01-21 09:51
    关注

    You need to have at least two columns domain_name varchar(400), tags text -- you need to make sure all tags are comma separated.

    Now, you make tags an index of type FULLTEXT to do full text search. See here for description. http://dev.mysql.com/doc/refman/5.0/en/fulltext-search.html

    On a quick Google, there are many posts on utilizing MySQL text search to get relevant results sorted by relevance. (Hope this is what you wanted).

    One such example is here http://www.pui.ch/phred/archives/2005/05/tags-with-mysql-fulltext.html It shows various ways to handle tag searches.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 易康econgnition精度验证
  • ¥15 线程问题判断多次进入
  • ¥15 msix packaging tool打包问题
  • ¥28 微信小程序开发页面布局没问题,真机调试的时候页面布局就乱了
  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致