Configuring sorting for non-English languages

As you might already know that Solr supports UTF-8 encoding and thus can handle data in many languages. However, if you ever needed to sort some languages that have characters specific to them, you probably know that it doesn't work well on the standard Solr string type. This recipe will show you how to deal with sorting and Solr.

How to do it...

  1. For the purpose of this recipe, I assumed that we will have to sort text that contains Polish characters. To show good and bad sorting behavior, we need to create the following index structure (add this to your schema.xml file):
    <field name="id" type="string" indexed="true" stored="true" required="true" /> <field name="name" type="text_general" indexed="true" ...

Get Solr Cookbook - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.