简体   繁体   English

预测/更正全文搜索

[英]Predicting/Correcting full text search

I am working on a web application which has a full text search feature working without any problems. 我正在开发一个具有全文搜索功能的Web应用程序,没有任何问题。 I would like to improve this and add a prediction/correction feature to it, meaning that if the user makes a typo or something which has 0 results, a corrected version of that input would get queried instead which has results. 我想对此进行改进并为其添加预测/修正功能,这意味着如果用户输入错字或具有0结果的内容,则会查询该输入的更正版本,而不会产生结果。 Basically somethig like Google's did you mean: x feature. 基本上像谷歌did you mean: x功能。

Is there an easy built-in way in Laravel to do this, or anything useful to check? Laravel有一个简单的内置方式可以做到这一点,还是有用的东西来检查? I have been Googleing the problem for some time now, but didn't find anything relevant. 我一直在谷歌问题一段时间,但没有发现任何相关的问题。

I'm using Laravel 4.2 with a MySQL database, if that matters something. 我正在使用带有MySQL数据库的Laravel 4.2,如果这很重要的话。

There isn't anything built in. Initially I would look at integrating a spellcheck - there are a couple of packages available on packagist, although I don't know how well they perform 没有任何内置的东西。最初我会考虑整合一个拼写检查 - 包装上有几个包可用,虽然我不知道他们的表现如何

https://packagist.org/search/?q=spell https://packagist.org/search/?q=spell

On a second level I guess you could store search terms in the DB and then do "People who searched for x also searched for y" 在第二级,我猜你可以在数据库中存储搜索词然后做“搜索x的人也搜索了y”

For the similar case, I used elastic search for 对于类似的情况,我使用了弹性搜索

Did you mean ...? 你的意思是 ...?

Elastic search does a lot more than this like it will sort relevant results on many different cases and many more. 弹性搜索比这更多,因为它会在许多不同的情况下对相关结果进行排序等等。 You can use Elasticquent for Laravel which implements elasticsearch to eloquent. 您可以使用Elasticquent for Laravel实现弹性搜索,以实现雄辩。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM