Facets summary does not take hierarchical facets into account in building a list of items.
And on the other hand, the DefaultFacetManager does not take into account that hierarchical facets could have already been built by DefaultFacetsSummaryManager.
Attached patch solves these two issues with facets summary (at least for me).
| Comment | File | Size | Author |
|---|---|---|---|
| #24 | facets_summary_breaks-2846294-24.patch | 13.14 KB | borisson_ |
| facets-summary-hierarchical-1.patch | 3.18 KB | jummonk |
Comments
Comment #2
borisson_Thanks, these changes look good, sorry for taking so long in getting to this issue.
I have some nits to pick with the current patch but the approach is solid!
Needs a full stop.
Should probably be
array $resultsand needs a description as well. I think these are all results right? Should we should do\Drupal\facets\Result\Result[] $results.Doing so removes the need for the inline @var comment
We can typehint on
arrayhere.Let's expand this comment a little bit.
Is this correct?
If the facets summary block is shown before this block, the children might have already been built. In that case, we should add them here.Comment #3
borisson_Tagging as novice, the nits are mostly docs.
Comment #4
themic8 commentedStill reviewing, but this patch has fixed my problem as well.
Also, looks like the counts might be cached. They disappear from time to time. Looking at this now.
Comment #5
shylajaphp commentedI am working on it.
Comment #6
shylajaphp commentedHi,
I have fixed the issue as per above suggestions.
Added new patch and interdiff file.
Comment #7
borisson_Thanks for those changes, this now needs an integration test to make sure this won't break again.
Comment #8
jummonk commentedWould you consider this addition? Adding facet id and raw result as an extra property to each facet result item of the facets summary block, so custom modules can override facets-result-item template and allow custom theming depending on facet id and/or facet item value. See patch in attachment.
Comment #9
jummonk commented@shylajaphp, apparently your patch broke my patch.
You removed this necessary piece from DefaultFacetManager:
And I was so incautious to base my new patch on yours.
I've adapted my latest patch to include yours and now it works again.
Comment #10
shylajaphp commentedThanks jummonk .
Comment #11
jummonk commentedPatch #8 and #9 are introducing an extra property in the facet result item. As this is not really related to the original issue I'm removing this extra feature and will make another feature request for that.
The new patch is without that unrelated feature.
Comment #13
borisson_Removing the novice tag, keeping the needs tests tag for an automated test-case. I'll give that a go later today.
Thanks for splitting up the feature request @jummonk!
Comment #14
borisson_Adds a test, if the test-only fails and the other patch passes we can commit this.
Comment #17
jummonk commented@borisson_. I'm afraid you have the 'extra' which I moved to another feature request in your new patch. You better base your patch on #10 and not #8 or #9
Comment #18
borisson_#11 + test from #14
Comment #20
borisson_Reroll of #18
Comment #22
borisson_This should fix the test.
Comment #24
borisson_Comment #25
borisson_Committed and pushed.