VeggieMeat / search_api_elasticsearch

Clone of project at drupal.org/project/search_api_elasticsearch for better CI options than what D.O offers
16 stars 8 forks source link

Indexing multilingual taxonomy terms as filters with their hierarchy intact #72

Open VeggieMeat opened 9 years ago

VeggieMeat commented 9 years ago

Original issue: https://www.drupal.org/node/2420837

I have a multilingual site which uses this module. it has been found that when indexing content and taxonomy tags there is a missing hierarchy when being sent to elasticsearch server.

This is hard to explain but image having taxonomy tags as follows:

Vocab: Tags
- Education (english)
-- Maths (english)
-- Science (english)
- Education (spanish)
-- Maths (spanish)
-- Science (spanish)

If i go to reindex my content on the spanish prefix/suffix of mysite.com/es/admin/config/search/search_api/index/my_index

Then all the spanish tags keep their hierarchy and these taxonomy terms I'm using as filters via views works as expected

When i visit my events listing page (spanish) - I have the filter: 'Education(spanish) (15)' and once i click that its children (maths(7) and science(8)). Brilliant.

However If i go to my english translation of the page then I dont get 'Education(english)' I merely get its children in a flattened list.

So I decided to check the index of elasticsearch and when doing some basic queries:

"get all from index where term id is education(english) and language = en" nothing returns.

If i do the opposite:

"get all from index where term id is education(spanish) and language = es" I get all the results which are related to the parent term.

This will also happen the other way round if we index in english and look at the spanish filters.