PHP 'smart'搜索引擎搜索Mysql表的建议 [英] PHP 'smart' search engine to search Mysql tables advice

查看:46
本文介绍了PHP 'smart'搜索引擎搜索Mysql表的建议的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

问题是,搜索引擎必须非常智能",以便用户可以轻松找到他们的项目(这是一个分类广告网站).

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)

但这还不够...

例如,假设字段 headline 包含类似 Bmw 330ci 的内容.如果我搜索 330,我不会得到任何结果.结尾 ('ci') 只是汽车模型中搜索表格时必须考虑的众多结尾之一.

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.

或者如果 headline 字段是 bmw330 会怎样?也没有结果,因为它只匹配完整的单词.

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

或者,如果 headlinebmw 330,我搜索 bmw 520,仍然使用 FULLTEXT 我会得到 bmw 330 结果,即使我搜索了 bmw 520... 不好!

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!

我该如何解决这个问题?

How should I solve this problem?

推荐答案

说到全文搜索,想要免费解决方案的人通常倾向于使用 SphinxSolr.

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

我没有使用过这两个中的任何一个,但我读过几次它们都很棒,而且很容易在 PHP 和 MySQL 中使用/与 PHP 和 MySQL 一起使用.

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 'smart'搜索引擎搜索Mysql表的建议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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