Thanks so much for this module! It would be great if it would also support facets that are based on related fields. Here's an example:
- Say I'm indexing the taxonomy term name instead of the whole taxonomy term entity, and built a facet based on that field.
- My facet query string will use the term name, so it will be something like f[0]=color:blue
.
- Currently, this module will always generate facet query strings using the referenced entity's id, since it passes in $entity->id()
as raw value when it generates a new Result
object in EntityReferenceFacetFormatterBase::viewElements
. As a result, the query string will be something like f[0]=color:123
, and the links won't point to a working faceted search page.
This patch does two things:
- The patch adds a setting to use the referenced entity's label instead of its id as the raw value when generating a new Result
object in EntityReferenceFacetFormatterBase::viewElements
. I'm actually not sure if we need to pass in a $display_value
there either, since it seems to work without passing one in (see what Facets module does in FacetsUrlGenerator::getUrl
- line 88).
- The patch also broadens the selection of facet candidates in the field configuration (EntityReferenceFacetFormatterBase::settingsForm
), so it finds facets based on related fields.
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.