开发者

Search engine with 'did you mean' [duplicate]

This question already has answers here: Closed 12 years ago.

Possible Duplicate:

How does the Google “Did you mean?” Algorithm work?

I have a database 开发者_如何学编程table with about 2 million records. I'm using mysql fulltext to searching but users very often enter bad words ex gmes -> should be games so I need a library with PHP wrappers to have feature like in google 'did you mean' What should I use?


You could use an API like Yahoo's Spelling Suggestion as any easy way of completing it with out having to roll your own.


An index is a list of words, and the place they occur. E.g. games occurs on row 123 and 456. If you have such a list with all words, you can easily search for the word that matches best. This way, you could match gmes with games.

However, this is not possible with the index MySQL provides.


if you're not planning to rely on 3rd party sites, you definitely need your own dictionary with levenshtein algorithm to find out how close the user entries are to the dictionary terms


You could use Yahoo Spelling API etc. if your queries are very generic. But if you have a domain specific vocabulary then you are better off using Apache Solr.

You can use it to index your 2MM records, easy! And use it as a search server with faceting etc. It also generate a spell-checker index out of your records which you can use for your "did you mean"? or the auto-suggest feature. It is also exceedingly simple to integrate into any language because of its RESTful API

Bottom-line: if you are looking for a long-term solution that can handle several things, in addition to spell-checking, such as search/auto-suggest/faceting etc. Solr is the way to go.


Another option would be the PHP Pspell functions in particular pspell_suggest, but you need to install the aspell library on the server.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜