Ignore accents - asciifolding? How to configure with tire?

(hsiu) #1

Tire may or may not be an appropriate topic here - apologies if not.

I'm inheriting a project using Elastic Search through tire, both of which I'm entirely unfamiliar with. I need to make searches ignore accents - that is, a search for "this" should return "thís" and "thiš". In my searches, it's clear that the asciifolding filter is appropriate for this. I am having trouble engaging that filter, however, and the documentation on tire merely says that "most options" for elastic search are available through tire, though not exactly how to translate an ES config to tire in Ruby.

Here's the mapping and indexing in the inherited project, I can not find similar examples of this syntax in the tire documentation making this all very difficult for me to parse:

tire.mapping do
indexes :id, :index => :not_analyzed
indexes :name, :filter => "asciifolding"
indexes :description, :filter => "asciifolding"
indexes :created_at, :type => 'date'
indexes :updated_at, :type => 'date'
indexes :file_type
indexes :indexed_files, :type => 'object' do
indexes :file, :type => 'object',
:properties => {
:title => {
:type => "multi_field",
:fields => {
:raw => { :type => 'string', :index => 'not_analyzed'},
:title => { :type => 'string', :filter => "asciifolding" }
:description => { :type => "string", :filter => "asciifolding" }

As you can see I've sort of arbitrarily put :filter => "asciifolding" in a few places I thought it seemed appropriate, or at least in the realm of possibility.

Any advice would be appreciated. Links to more complete documentation (I didn't find Elastic Search's particularly useful, either, unfortunately) would be appreciated as well.

(system) #2