Views blocks/attachments with facet search do not respect search

Created on 26 February 2020, over 4 years ago
Updated 13 March 2023, over 1 year ago

Hi there,

I'm trying to build a search API view that lists data in a table, with a map attachment on the top. I've been unable to get the attachment to respect the search results (based on a facet that I am using to search with). For instance, lets say I have content with a field called "state". If I build a list of facets (as a block) and then also have a view, I can successfully get the facet selection to limit the search correctly for the main page. However, if I am trying to put an attachment there to also map the results (or anything, really -- I've even tried just an unsorted list to eliminate maps being a problem), the search does not seem to reflect in this attachment. I've also tried a block on the same page as the view, with similar results.

Is there any way to have an attachment to the view respect a search when someone chooses a facet?

Thanks for the help.

💬 Support request
Status

Needs review

Version

3.0

Component

Code

Created by

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.

  • 🇧🇷Brazil batalhasamuel

    @john.oltman and @attisan I tested the patch from #16 and it worked partially. If the result exists in both View and Attached View, the facet shows the filter option and filters considering the two parts. But if the filter has an option that only has results for the view, the facet filter option is not shown.
    To add more information I'll give a real example: I have a view with a Live event list, and an Attached View with a Recorded event list.
    If both lists have events in the French language, the filter option French appears and works for both. If the French language is only present in the attached view from the Recorded event list, the filter option is not shown to me because the rule from facet settings that handle the empty filter result behavior is just considering the View, not the Attachment.

    Can someone help me with this? I couldn't go further than this yet.

  • 🇧🇷Brazil thiagomoraesp

    Same problem as Samuel ( #20 ) here, someone can help?

  • Status changed to RTBC 10 months ago
  • 🇧🇪Belgium StryKaizer Belgium

    concerning #20.

    For building facet items, we need 1 single query to retrieve the possible filter values.
    Since you have different filters in your attachment, that wont technically be possible as these are 2 different queries to retrieve your resultset.

    This is something which facets will probably never support, as it will get complicated very fast if we merge filters from different sources.

    Patch from #16 works fine for my use-case, where the attachment renders the first result in a different layout (and other results have offset 1)

  • 🇧🇪Belgium borisson_ Mechelen, 🇧🇪

    This looks great, but I think we should probably add a test or it also?

  • Status changed to Needs work 4 months ago
  • 🇳🇱Netherlands idebr
    1. The views Facets display extender needs a config schema. See the metatag module for a reference: https://git.drupalcode.org/project/metatag/-/blob/8.x-1.x/metatag_views/...
    2. Needs a test per #23
  • 🇬🇧United Kingdom effortDee

    Any more updates on this? I'm looking at controlling an attachment map on a views page I have built and for facets to control both the page and the attachment map.

Production build 0.71.5 2024