MYSQL全文搜索和LIKE [英] MYSQL Fulltext search and LIKE

查看:115
本文介绍了MYSQL全文搜索和LIKE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用MySQL全文搜索,但发现它缺少的情况下,您的字符串是字段中单词的一部分。如果我的领域是纽约时报,我搜索时间我没有结果。解决这个问题的方法是设置两个查询,一个查询全文,另一个查询:

I am working with MySQL full text search but find it lacking in situations where your string is part of a word within a field. If my field is "New York Times" and I search for "Time" I get no results. The hackish way to solve this is to set up two queries, one that does a full text search and the other that does:

SELECT * FROM ___ WHERE 'string' LIKE %searchterm% 

有没有什么方法可以设置我的全文搜索解决这个问题,所以我不必运行额外的查询?

Is there any way that I can set up my full text search to solve this issue so I don't have to run the extra query?

推荐答案

我已经基本上给使用MySql的全文搜索来支持 Sphinx - 一个专门的全文搜索引擎,它实现了MySql的网络协议,因此您可以在您的客户端和MySql服务器之间插手它,不会丢失任何内容并获得丰富,严肃的全文功能。也许它不适合你的需求(你不完全表达),但我认为这至少是工作检查!

I've basically given up on MySql's full text search in favor of Sphinx -- a dedicated full-text search engine which implements MySql's network protocol so you can "interpose" it between your clients and a MySql server, losing nothing and gaining rich, serious full-text capabilities. Maybe it's not suitable for your needs (which you don't fully express), but I think it's at least work checking out!

这篇关于MYSQL全文搜索和LIKE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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