Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Asciifolding not working Elastic Search Rails

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'
                    }
                }
           }

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.

like image 714
AMBasra Avatar asked Sep 10 '13 11:09

AMBasra


1 Answers

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'
                    }
                }
like image 104
AMBasra Avatar answered Oct 22 '22 06:10

AMBasra