Question

After following the advices on this question:

i18n search using tire and Globalize3

I indexed my title and body fields. The problem is that while the indexing works, when I conduct a search, it does not fold the accents. I configured the searched model like so:

settings index: { analysis: {
                    analyzer: {
                      index_analyzer: {
                        tokenizer: "whitespace",
                        filter: ["asciifolding", "lowercase", "snowball"]
                      },
                      search_analyzer: {
                        tokenizer: "whitespace",
                        filter: ["asciifolding", "lowercase", "snowball"]
                      }
                    }
                  }
                }

So why isnt Tire using these analyzers?

Was it helpful?

Solution

Are you applying those analyzers to any field? Are you searching on that field, or on the _all field?

If you intend to use those analyzers as the default analyzers for the whole index, then they should be named default_index and default_search. In fact they're both the same, so you could just specify the analyzer once as default.

This is how Elasticsearch determines which analyzer to use at index time:

  • the index_analyzer defined in the field mapping, else
  • the analyzer defined in the field mapping, else
  • the analyzer defined in the _analyzer field of the document, else
  • the default index_analyzer for the type, which defaults to
  • the default analyzer for the type, which defaults to
  • the analyzer named default_index in the index settings, which defaults to
  • the analyzer named default in the index settings, which defaults to
  • the analyzer named default_index at node level, which defaults to
  • the analyzer named default at node level, which defaults to
  • the standard analyzer

and at search time:

  • the analyzer defined in the query itself, else
  • the search_analyzer defined in the field mapping, else
  • the analyzer defined in the field mapping, else
  • the default search_analyzer for the type, which defaults to
  • the default analyzer for the type, which defaults to
  • the analyzer named default_search in the index settings, which defaults to
  • the analyzer named default in the index settings, which defaults to
  • the analyzer named default_search at node level, which defaults to
  • the analyzer named default at node level, which defaults to
  • the standard analyzer
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top