The supportsFacet function that was added in "Disable boolean processor on non-boolean facets" https://www.drupal.org/project/facets/issues/2913244 is too restrictive. I have a facet that is created on a boolean search field on an entity-reference field on a content type. The supportsFacet check is returning false because it is using $definition->getDataType(), which in this case is returning entity reference, even though my facet is on a boolean search field. Looking for a way to have the check look at the search field type instead.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

nrackleff created an issue. See original summary.

nrackleff’s picture

I'm adding a patch here that is absolutely NOT intended to be a real solution to this problem. This patch just has the supportsFacet function return true without doing any checks. This is just to stop it from hiding the form at all so I can use it on a site where I need it.

TrevorBradley’s picture

I'm hitting something similar. My aggregate boolean field somehow has a type definition of "string". Good to know I'm not alone!

I'm going to resolve this by making my own BooleanItemProcessor plugin, extending the original but having supportsFacet return TRUE.

borisson_’s picture

Status: Active » Needs review

Let's see if this still applies, because if it does I don't see any harm in applying this. I'd prefer a little bit more visual clutter over things not working.

Mikechr’s picture

Instead of showing the Boolean processor on all facets return TRUE I believe it would be better to show the processor only if the field is indexed as a boolean field.

Status: Needs review » Needs work

The last submitted patch, 5: supportsFacet-too-restrictive-3010328-5.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

helioha’s picture

Creating a patch based on #5. I kept the old code intact since I'm not sure if removing it could break things.

borisson_’s picture

Version: 8.x-1.1 » 8.x-1.x-dev
Status: Needs work » Reviewed & tested by the community

This looks great, we should probably also write a test for this. But I'm not too unhappy with this going in as-is.

  • mkalkbrenner committed 215f577 on 8.x-1.x authored by helioha
    Issue #3010328 by nrackleff, Mikechr, helioha, borisson_, TrevorBradley...
mkalkbrenner’s picture

Status: Reviewed & tested by the community » Fixed

Committed, thanks for your help!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.