在php/mysql中将错字校正实施到搜索中的最佳方法是什么? [英] What's the best way to implement typo correction into a search in php/mysql?

查看:95
本文介绍了在php/mysql中将错字校正实施到搜索中的最佳方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个列出电影的网站.人们自然会在搜索电影时犯拼写错误,当然,事实是某些电影带有撇号,使用字母来拼写标题中的数字,等等.

I have a site that lists movies. Naturally people make spelling mistakes when searching for movies, and of course there is the fact that some movies have apostrophes, use letters to spell out numbers in the title, etc.

如何让我的搜索脚本忽略这些错误?可能需要比WHERE mov_title LIKE '%keyword%'聪明一点的东西.

How do I get my search script to overlook these errors? Probably need something that's a little more intelligent than WHERE mov_title LIKE '%keyword%'.

有人建议我使用全文搜索引擎,但是所有这些看起来都非常复杂,我觉得将它们构建到我的应用程序中就像是人间地狱.如果我必须使用一种,那么侵入性最小的是什么,那么将其最容易实现到现有代码中?

It was suggested that I use a fulltext search engine, but all of those things look really complicated, and I feel that building them into my application will be like hell on earth. If I do have to use one, what's the least invasive one, that will be most painless to implement into existing code?

推荐答案

我认为您必须实现一个外部全文搜索引擎. MySQL只是不擅长全文搜索.我想你应该给 Lucene ( Zend Framework有一个API 可以插入Lucene,从而更加容易学习和利用.

I think you'll have to implement an external fulltext search engine. MySQL just isn't good at fulltext search. I'd say you should give Lucene a go (tutorials). Zend Framework has an API that plugs into Lucene, making it easier to learn and utilize.

这篇关于在php/mysql中将错字校正实施到搜索中的最佳方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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