Looking for help displaying the suggestions in a view

Created on 9 February 2025, 2 months ago

Problem/Motivation

Thanks very much for a great module.
The display mode functionality works great, but I was wondering if we could leverage views for the displaying of the suggestions. I would like to be able to display the suggestions in a sort of view.

I realize this might be a bit of a big task, but I might be willing to get the ball rolling, even if it means a separate module.

Thanks!

💬 Support request
Status

Active

Version

1.0

Component

Documentation

Created by

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

Comments & Activities

  • Issue created by @tonytheferg
  • 🇦🇹Austria drunken monkey Vienna, Austria

    Thanks for posting this suggestion.

    However, it seems using Views for this purpose would be an incredible overkill. We’d either have to create a temporary table with the suggestions for every autocomplete request or write a completely new Views query plugin to support this. In the latter case, getting filters or sorts to work would require even more effort.
    Currently, we also just render individual rows and pass them back to the client in a JSON array, so it would be tricky to make this work with a view and probably lose the view’s surrounding markup.

    All in all, I think you’ll have to create your own module for this. You can use hook_search_api_autocomplete_suggestions_alter() to implement this functionality, I think. Just use setRender() to set the HTML you want to display for each suggestion.
    If you publish the module and it has enough users, we can consider integrating it as an option into this module after all.

  • Thanks!
    On an unrelated note, has anyone requested a "view all results" link setting for UI? As some might not think to submit the form to land on the search page.

  • 🇦🇹Austria drunken monkey Vienna, Austria

    I don’t think so, no, but does sound like a good idea.
    Maybe look through the existing open issues first but then feel free to create a new feature request for it. Thanks!

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

Production build 0.71.5 2024