Multilingual search with Haystack

160 views
Skip to first unread message

Simon Bächler

unread,
Aug 17, 2014, 5:16:03 AM8/17/14
to django...@googlegroups.com
Hi

I need to set up a search server for our production servers. Each production server has multiple Django instances and every instance has multiple languages.
As a search backend I'm leaning towards Elasticsearch because it is easier to add new sites to the index. 

Unfortunately Haystack associates a text field with a text_en backend field by default. The solution they suggest for multi language sites doesn't really work if you are using multilingual models such as those created by 'django-modeltranslation'. 

There is a great blog post about how to create a multilingual router for Solr to get and post data to the search server.
It could be easily modified for Elasticsearch. 
But I haven't found a solution for multilingual index creation.

Regards
Simon

Collin Anderson

unread,
Aug 17, 2014, 8:26:23 PM8/17/14
to django...@googlegroups.com
Could you simply have a field to record the language, and then filter by that language when searching?

Simon Bächler

unread,
Aug 19, 2014, 4:19:31 AM8/19/14
to django...@googlegroups.com
It's not that simple. When using a search server you should have a separate index per language. Search server are processing text to improve indexing such as saving only the stem of a verb or removing plurals. This is highly language specific.

The main problem is therefore the schema creation and schema updates for each language. It's not that hard to write a router that sends the request to the correct index once it is setup.
Reply all
Reply to author
Forward
0 new messages