1

I have a CT product and a CT factory. Products have an entity reference field pointing to factories. I use node translation on factories (en, fr, de) but products are not translated (en only).

Creating facet on the product's factory (entity reference field) and indexing works well but the problem is that the facet displays all translated versions of factories. e.g:

china factory in english (14)
china factory in french (14)
china factory in german (14)
taiwan factory in english (6)
taiwan factory in french (6)
taiwan factory in german (6)
EU factory in english (2)
EU factory in french (2)
EU factory in german (2)

Since the search page regards products which are only in english, I'd like to be able to remove the fr and de values from that facet, or even better, not allow them to be indexed at all.

I've tried the facetapi_bonus module but its options for values exlusions doesn't suit me because I don't know the titles of the factories or their node ids beforehand.

1

I will venture a guess that when choosing indexed fields for the Product CT, you selected 'Factories' field and created the facet against this. Since you are using node translation, it is quite sensible that all available nodes (in various languages) are displayed in the facet. I suggest you try the following:

  • Remove/disable field 'Factories' from the list of indexed fields and remove the respective facet
  • At the bottom of the fields configuration for the index, you will find an option labeled 'Add related fields'. Choose field 'Factories'. With this action, all fields of the referenced Factory CT will become available for indexing
  • Enable the field that is correlated with the translation source node. Label should be something like this 'Factories >> Translation source node'. Create a new facet against this field
  • Clear indexed data and re-index

Most probably, the new facet will only display the facet terms in the default translation language (English in your case)

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.