I have multiple indexes, possible to have one search bar with a dropdown to select which index you would search?

Created on 9 October 2024, 2 months ago

I have three search indexes, food, events, routes.

Each have their own views page where you can search for, filter (facets) and sort the many foods, events and routes on their respective pages, along with a search bar on each page.

Is it possible to have a search bar in the header of the website that has a dropdown or some other functionality that you can select what section (search index) of the site you will search with the term/phrase you add in to that search bar?

So say I put in "energy gel" in to the search bar and click the dropdown within that bar that selects "food".

Or I put in "England" in the search bar and click the dropdown "events" and then it takes me to the events views page and the search "england" was performed on that search api view.

Rather than having 3 separate search bars in the header of the site, i want one.

Feature request
Status

Active

Version

1.0

Component

General code

Created by

🇬🇧United Kingdom effortDee

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

Comments & Activities

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

    Since the Search API module in general doesn’t provide any search pages, blocks or other user-facing UI, I don’t think adding something like this to this module would make much sense.
    Since all your search pages are views there might be some Views-related contrib module that already lets you do something like this – enter something in a text field and than submit to one of several views at the user’s choice. However, I guess this feature mostly makes sense for searches, so not sure if it exists yet.

    I, in any case, don’t know of something like that, so if you cannot find anything you’d have to write some code for this yourself. The code would be pretty simple – a block with a form, containing a textfield and a dropdown, that submits the entered keyword to the selected page. But only trivial if you are a developer, of course.

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

Production build 0.71.5 2024