Question

I have a User model. Each user can speak 2 languages. So I have 2 integer columns speak_1 and speak_2 in my DB. Each integer correspond to one language : 1 -> french 2 -> english etc.

I'd like to filter by facets all the users who speak one particular language (= all the user whith speak_1 or speak_2 attribute set to 1)

So I defined this indice :

has [speak_1, speak_2], as: :speak, type: :integer, facet: true

I was hoping it will work because this kind of attributes does :

has mobilities(:city_id), :as => :mobile_cities_ids

But it only consider the speak_1 values in my facets search then Any idea ?

Was it helpful?

Solution

If you add :multi => true to the attribute definition and then run ts:rebuild, does that get things working? Although I would hope TS is smart enough to realise multiple columns means multiple values.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top