Asciifolding无法正常工作Elastic Search Rails [英] Asciifolding not working Elastic Search Rails

查看:83
本文介绍了Asciifolding无法正常工作Elastic Search Rails的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在尝试为我的Rails应用程序使用 asciifolding 时遇到了非常困难的时期。
我想搜索包含 重音字符的单词,例如当我搜索 foroige 时我想出现 foróige
我尝试了很多事情。下面是其中的一些。

I am having a really bad time trying to get "asciifolding" working for my Rails app. I want to search words containing "accented" characters for example i want "foróige" to come up when i search "foroige". I have tried many things. A couple of them are below.

analysis: {
                analyzer: {
                    text: {
                        tokenizer: "standard",
                        filter: ["standard","lowercase", "asciifolding"],
                        char_filter: 'html_strip'
                    },
                    sortable: {
                        tokenizer: "keyword",
                        filter: ["lowercase", "asciifolding"],
                        char_filter: 'html_strip'
                    }
                }
           }

我还尝试通过遵循James Healey charmap的狮身人面像来重音字符来尝试char_filter。
http://yob.id.au /2008/05/08/thinking-sphinx-and-unicode.html

I have also tried char_filter by following James Healey charmap for sphinx for accented characters. http://yob.id.au/2008/05/08/thinking-sphinx-and-unicode.html

我们非常感谢您的帮助。

Any help is highly appreciated.

推荐答案

玩了之后,我解决了这个问题。我必须更改默认分析器的行为。

After playing around with it i resolved the issue. I had to change the behaviour of the default analyzer.

analyzer: {
                    default: {
                        tokenizer: "standard",
                        filter: ["standard", "lowercase", "asciifolding"]
                    },
                    text: {
                        tokenizer: "standard",
                        filter: ["standard", "lowercase"],
                        char_filter: 'html_strip'
                    },
                    sortable: {
                        tokenizer: "keyword",
                        filter: ["lowercase"],
                        char_filter: 'html_strip'
                    }
                }

这篇关于Asciifolding无法正常工作Elastic Search Rails的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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