duancong6937 2011-04-09 08:07
浏览 19
已采纳

php如何通过日期单元2全文搜索和订购?

I want to make a fulltext search, there are 2 group search query, one search match word 'Harry' and 'potter', second search query only match word 'Rowling'. How to unit them and order dy date? Then $query1 relevance is 70%, $query1 relevance is 30%? Thanks.

$query1 = "SELECT * FROM articles WHERE MATCH (title,content) AGAINST ('+Harry +potter' IN BOOLEAN MODE)";//all the articles both match word 'Harry' and 'potter'
$query2 = "SELECT * FROM articles WHERE MATCH (title,content) AGAINST ('+Rowling' IN BOOLEAN MODE)";//all the articles macth 'Rowling'
  • 写回答

1条回答 默认 最新

  • douqiao1983 2011-04-09 10:39
    关注

    Both your queries select rows from the same table and the same columns set. What about UNION?

    $query = "SELECT * FROM articles WHERE MATCH (title,content) AGAINST ('+Harry +potter' IN BOOLEAN MODE)
    UNION
    SELECT * FROM articles WHERE MATCH (title,content) AGAINST ('+Rowling' IN BOOLEAN MODE)";
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 mmocr的训练错误,结果全为0
  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀