我正在构建遵循此工作流程的监控Web应用程序:
一个品牌的(沃尔沃,宝马等)社交账户,这个例子的facebook,链接到应用程序,所有信息(评论,反应,帖子)被检索并保存到本地数据库。
统计信息会生成并显示在内部仪表板上。
然后,用户可以从此仪表板中搜索包含特定单词的帖子或评论。
我在搜索表单上使用Select2,只允许用户搜索单个词,即。 [坏,汽车,服务]。
使用mySQL搜索的一个简单的实现已经被部署,并且我自从与Elastic Search合作以获得更好的解决方案。
所以我的问题是:
在本地数据库中,我有5条记录,其中包含:
“这辆车真的很糟糕” “这辆车真是太棒了” “这辆车真的很放心” “这辆车真的很脆弱” “这辆车真是太棒了”当用户搜索“糟糕的”时,如何获取所有这些记录?
我一直在尝试用他们的文档中的短语建议示例,但没有任何运气。
谢谢。
I'm building a monitoring web app that follows this workflow:
A brand's (volvo, bmw, etc) social account, facebook for this example, is linked to the app and all the info (comments, reactions, posts) is retrieved and saved to a local DB.
Stats are generated and displayed on an internal dashboard.
Users can then search from this dashboard for posts or comments containing certain words.
I am using Select2 on the search form and only allowing users to search for individual words ie. [bad, car, service].
A simple implementation using mySQL search has already been deployed and I am since working with Elastic Search for a better solution.
So my question is:
On the local database I have 5 records containing:
"This car is really awful" "This car is really awfeul" "This car is really waful" "This car is really awfful" "This car is really awfull"How can I get all this records back when the user searches for "awful"
I have been trying with the phrase suggest example on their documentation without any luck.
Thanks.
最满意答案
请看看模糊性或模糊查询 。 应该对你有帮助。
您可以使用match查询进行fuzziness = AUTO :
GET /_search { "query": { "match" : { "your_field_name" : { "query" : "awful", "fuzziness": "AUTO" } } } }如果AUTO不够,你可以在文档中指定参数。
Please, take a look on fuzziness or fuzzy query. Should be helpful for you.
You can use match query for with fuzziness = AUTO:
GET /_search { "query": { "match" : { "your_field_name" : { "query" : "awful", "fuzziness": "AUTO" } } } }if AUTO is not sufficient you can specify the param base on documentation.
更多推荐
发布评论