Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Facets are shown for nodes which has not translation.
I mean:
Site with two languages: English and French. I have 5 nodes in English version and has not translations to French, and two facets: Node title and Taxonomy term.
On English version all is ok, but when we switch to French we have facets for English version without search results.
Facet titles are tranclated to French.
Expected result: no facets. As i have not nodes in French version.
Comment | File | Size | Author |
---|---|---|---|
#8 | facets_on_multilangual-2827808-8.patch | 3.13 KB | borisson_ |
Comments
Comment #2
divined CreditAttribution: divined commentedComment #3
borisson_I've just confirmed this - not sure how we should resolve it though. Not even sure if this is facets or search api related. I guess we'll need to discuss this.
In any case, we also need tests for this - our current language-specific tests are very basic.
Comment #4
borisson_Adding tag
Comment #5
divined CreditAttribution: divined commentedAdding Count limit processor solve half of problems.
But we have another:
3 Node, 2 Terms
Node1 with Term1
Node2 with Term1 and Term2
Node3 with Term2
--
Select facets for all Node titles and Term titles. Then unselect Node1, Term2 and then Node2.
All facet filter will disapeared from the page, and you get an empty result page.
Because you have active filter returns zero count only. (Active filters: Node3 and Term1)
---
I solve this problem in this variant:
New count limit processor:
Active results will skipped.
Comment #6
borisson_This is expected.
Facets use the same limitations as the query object passed, so when using views, add a filter to the view to limit to one language.
Otherwise, this is solved by adding a `hook_search_api_query_alter()` that limits the results to the current language.
I've added a test to make sure that this behavior works.
Comment #7
borisson_Needed a reroll
Comment #8
borisson_Comment #10
borisson_Committed and pushed.