I am creating a search engine for my php based website. I need to search a mysql table.

我正在为我的php网站创建一个搜索引擎。我需要搜索一个mysql表。

Thing is, the search engine must be pretty 'smart', so that users can easily find their items (it's a classifieds website).

问题是,搜索引擎必须非常“智能”,这样用户就可以很容易地找到他们的条目(这是一个分类网站)。

I have currently set up a FULLTEXT search with this piece of code:

我现在用这段代码建立了一个全文搜索:

    MATCH (headline) AGAINST ($querystring)

But this isn't enough...

但这是不够的…

For instance, lets say the field headline contains something like Bmw 330ci. If I search for 330, I wont get any results. The ending ('ci') is just one of many endings in car models which must be taken into account when searching the table.

例如,假设字段标题包含宝马330ci。如果我搜索330,我不会得到任何结果。词尾(“ci”)只是汽车模型中的众多词尾之一,在搜索表时必须考虑到这一点。

Or what if the headline field is bmw330? Also no results, because it only matches full words.

或者如果标题栏是bmw330呢?也没有结果,因为它只匹配完整的单词。

Or also, what if the headline is bmw 330, and I search for bmw 520, still with FULLTEXT I will get the bmw 330 as a result, even though I searched for bmw 520... Not good!

或者,如果标题是宝马330,我搜索宝马520,仍然有全文,我会得到宝马330,即使我搜索宝马520……不是很好!

How should I solve this problem?

我该如何解决这个问题?

3 个解决方案

#1


3

When it comes to fulltext search, people who want free solutions often tend to use either Sphinx or Solr.

当涉及到全文搜索时,想要免费解决方案的人通常会使用Sphinx或Solr。

I've not used any of those two, but I've read several times that they were great, and easy to use from/with PHP and MySQL.

我没有使用过这两种工具,但是我读过好几次,它们非常棒,并且很容易从PHP和MySQL中使用。

更多相关文章

  1. 字体图标的引入和通过媒体查询改变导航样式
  2. HTML样式和常用选择器
  3. 字体图标的引用和自定义样式/媒体查询的使用
  4. 数据库的CURD操作、PDO本质与原理的学习
  5. CSS之伪类选择器和简单盒子简单案例
  6. 伪类选择器与盒模型常用属性
  7. 伪类选择器-结构伪类、根据位置选择匹配
  8. 7.4——常用标签与应用场景之表格与单元格
  9. css伪类选择器和盒模型

随机推荐

  1. Android(安卓)sdk 安装及Adk安装
  2. [Android(安卓)硬件] android手机主流屏
  3. 每日学习-ansible yum模块
  4. Android(安卓)关于手指拖动onScroll、onF
  5. Android(安卓)Bluetooth Address
  6. android中file的使用实例
  7. 聊一聊面试中常问的java阻塞队列
  8. 详解第三种创建线程的方式-Callable接口
  9. android 编译环境
  10. Android和H5交互-基础篇