荣耀彩票代理

IT技术互动交流平台

关于MATCH AGAINST模糊搜索的详细操作教程

作者:whl  来源:网络整理  发布日期:2018-11-16 08:33:00

  XIANGXINHENDUODIANNAOYONGHUDUIYUmysqlBINGBUSHIHENSHUXI,YOUXIECAOZUODOUBUZHIDAOGAIRUHEJINXING。JINTIANJIANGJIDAJIAJIANGJIEYIXIAGUANYUMATCH AGAINSTMOHUSOUSUODEXIANGXICAOZUOJIAOCHENG,XIAOBIANGERENRENWEIZHEIGEJIAOCHENGHAISHIFEICHANGJUYOUXUEXIJIAZHIDE,HENDUOSHIHOUYOULEZHEIGEFANGFACAOZUOQILAISHENGLIHENDUO。

荣耀彩票代理  mysql 4.xYISHANGTIGONGLEQUANWENJIANSUOZHICHI MATCH ……AGAINST MOSHI(BUQUFENDAXIAOXIE)

  JIANLIQUANWENSUOYINDEBIAODECUNCHUYINQINGLEIXINGBIXUWEIMyISAM

荣耀彩票代理  WENTISHImatch againstDUIZHONGWENMOHUSOUSUOZHICHIBUSHITAIHAO

  XINJIANYIGEutf8 MyISAMLEIXINGDEBIAOBINGJIANLIYIGEQUANWENSUOYIN :

全文索引

  QIZHONGFULLTEXT(title, body) JItitleHEbodyZHEILIANGLIEJIANLIQUANWENSUOYIN,ZHIHOUJIANSUODESHIHOUZHUYIBIXUTONGSHIZHIDINGZHEILIANGLIE。

  JIZHEIGEBIAOTIANJIADIANCESHISHUJU

添加点测试数据

  QUANWENJIANSUOCESHI

全文检索测试

  ZHUYI MATCH (title,body) LIMIANDEZHIBIXUSHIQIANMIANJIANLIQUANWENSUOYINDELIANGGEZIDUANBUNENGSHAO。

荣耀彩票代理  mysql MORENZHICHIQUANWENJIANSUODEZIFUZHANGDUSHI4,KEYIYONGSHOW VARIABLES LIKE 'ft_min_word_len' LAICHAKANZHIDINGDEZIFUZHANGDU,YEKEYIZAImysqlPEIZHIWENJIANmy.ini GENGGAIZUIXIAOZIFUZHANGDU,FANGFASHIZAImy.ini ZENGJIAYIXING BIRU:ft_min_word_len = 2,GAIWANHOUZHONGQImysqlJIKE。

  另外,MySQL还会计算一个词的权值,以决定是否出现在结果集中,具体如下:

荣耀彩票代理  mysqlZAIJIHECHAXUNZHONGDEDUIMEIGEHESHIDECIDOUHUIXIANJISUANTAMENDEQUANZHONG,YIGECHUXIANZAIDUOGEWENDANGZHONGDECIJIANGYOUJIAODIDEQUANZHONG(KENENGSHENZHIYOUYIGELINGQUANZHONG),YINWEIZAIZHEIGETEDINGDEJIZHONG,TAYOUJIAODIDEYUYIZHI。FOUZE,RUGUOCISHIJIAOSHAODE,TAJIANGDEDAOYIGEJIAOGAODEQUANZHONG,mysqlMORENDEFAZHISHI50%,SHANGMIAN‘you'ZAIMEIGEWENDANGDOUCHUXIAN,YINCISHI100%,ZHIYOUDIYU50%DECAIHUICHUXIANZAIJIEGUOJIZHONG。

  QUANWENJIANSUOYUFA

全文检索语法  

  BIAOSHIAND,JIBIXUBAOHAN。- BIAOSHINOT,JIBUBAOHAN。

 表示AND

  appleHEbananaZHIJIANSHIKONGGE,KONGGEBIAOSHIOR,JIZHISHAOBAOHANapple、bananaZHONGDEYIGE。

  包含apple、banana

荣耀彩票代理  BIXUBAOHANapple,DANSHIRUGUOTONGSHIYEBAOHANbananaZEHUIHUODEGENGGAODEQUANZHONG。

获得更高的权重

荣耀彩票代理  ~ SHIWOMENSHUXIDEYIHUOYUNSUANFU。FANHUIDEJILUBIXUBAOHANapple,DANSHIRUGUOTONGSHIYEBAOHANbananaHUIJIANGDIQUANZHONG。 DANSHITAMEIYOU +apple -banana YANGE,YINWEIHOUZHERUGUOBAOHANbananaYAGENJIUBUFANHUI。

包含banana压根就不返回

  FANHUITONGSHIBAOHANappleHEbananaHUOZHETONGSHIBAOHANappleHEorangeDEJILU。DANSHITONGSHIBAOHANappleHEbananaDEJILUDEQUANZHONGGAOYUTONGSHIBAOHANappleHEorangeDEJILU。

  GUANYUmysqlLIMATCH AGAINSTDEMOHUSOUSUOJINTIANJIUJIDAJIAJIESHAODAOZHEILILE,XIAOBIANGANJUEHAISHIFEICHANGJIANDANYICAOZUODE,DAJIABUYAODANXINYINWEITAINANCAOZUOHUISHIBAIERBUGANXIASHOU。RUGUODAJIADUISHANGMIANDENEIRONGHAIYOUSHENMEYIHUODEHUAKEYIJIXIAOBIANLIUYAN,DAJIAYIQIJIAOLIUJIEJUE。

 

延伸阅读:

Tag标签:      
  • 专题推荐

About IT165 - 广告服务 - 隐私声明 - 版权申明 - 免责条款 - 网站地图 - 网友投稿 - 联系方式
本站内容来自于互联网,仅供用于网络技术学习,学习中请遵循相关法律法规