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

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

问题描述

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

事实是,搜索引擎必须相当智能",以便用户可以轻松找到他们的商品(这是一个分类网站).

我目前已使用以下代码设置了FULLTEXT搜索:

    MATCH (headline) AGAINST ($querystring)

但这还不够...

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

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

或者,如果headlinebmw 330,并且我搜索bmw 520,仍然使用FULLTEXT,即使我搜索了bmw 520,我仍然会得到bmw 330.不好!<​​/p>

我应该如何解决这个问题?

解决方案

在全文搜索方面,想要免费解决方案的人通常倾向于使用 Sphinx Solr .

我没有使用过这两个中的任何一个,但是我已经读过好几次了,它们很棒,并且易于在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)

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.

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

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?

解决方案

When it comes to fulltext search, people who want free solutions often tend to use either Sphinx or 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'smart'搜索引擎搜索Mysql表的建议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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