Alter facets query or remove options before render

Created on 11 November 2020, over 4 years ago
Updated 11 March 2025, 23 days ago

Problem/Motivation

I'd like to alter the query to retrieve the facet options, or remove some options before they're rendered. Does this module provide any hooks that would allow me to do that? It seems there is no documentation for this module.

The reason I need to do this is to address/work around a bug that I think is too obscure and intermittent to create an issue for. I'm using search_api, search_api_solr, facets, search_api_opensolr and OpenSolr to create several faceted search views of various content types. Occasionally results will "slip" past the views content type filter so that nodes of an incorrect content type will be displayed in the results. The same will occasionally happen with a particular facet based on an Entity reference field to a content type. The facet will display apparently random nodes of a different content type. Reindexing will always resolve these issues until they pop up again.

Like I said, I think this is too obscure and intermittent to create an issue for. I'm pretty certain nobody would be able to replicate it, and either way I can't say which module is at fault. I now have a views hook in place that filters the results a final time before displaying the results, which seems to work around the bug for the search results. Now I need to do the same for this particular facet based on an Entity reference field.

πŸ’¬ Support request
Status

Closed: won't fix

Version

1.4

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States maskedjellybean Portland, OR

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡§πŸ‡ͺBelgium borisson_ Mechelen, πŸ‡§πŸ‡ͺ

    This is not something we can currently do in facets, and given the lack of interest in this issue in the past several years, I think we can close this.

    It sounds however like you have found an issue in Search API, so if it still happens we need to figure it out there

Production build 0.71.5 2024