Forum Academy Marketplace Showcase Pricing Features

Can You Search 3 Fields In One Search Box?

Is it possible to search 3 different fields within one search box?

I want to be able to display an input similar to the below and have the user input any of the 3 things to search against.

When i configure a search box it asks me for the field to search and it only gives me one option.

Can it be solved with a regular input field and showing the results in stacked Repeating Groups instead? You can filter the results through the “Any field contains”.

As far as I know, the Search Input only supports one field.

2 Likes

It is messy, but you could create a separate combined “search” field thing that has all the city names and codes in the same field (assumption is that it is fairly static so that admin overhead isn’t huge). Each entry then points to an Airport thing.

Then you can do typeahead on that and the selection can drive the airport selected.

1 Like

This is what I also do for more complex searches. I have a data type called “search index” and store a text field called type and another field of the actual type(s) I’m searching on (e.g. searching users and tags, potential types can be “user” and “tag”; then I’ll direct to the appropriate page based on the type and pass the user or tag payload that is stored on the search index).

But if I combine codes + airport names into one field in the DB how can they correlate to one another?

An airport has a name, city, and code (1 line in the db). If I combine all 3 lines into 1 column and search against it how can I access the other correlated data?

Or am I missing something here all together?

That would mean 3 rows in the “search index” pointing to one airport row.

LGW > London Gatwick
Gatwick > London Gatwick
London > London Gatwick

Wow. Messy is no joke…

40,000 airports and it looks like i need to add 2 rows and splice out the airport code + name + city so that there are 3 fields pointing to the one airport… Is this correct thinking?

Yeah, so 120,000 rows in total (one per search criteria) … that might be interesting to search through.

Putting it into its own data type with just “Search Name” and “Airport” might make it quicker.

But all you can do is try it and see I am afraid.

1 Like

I hear ya.

Besides the larger factor of rows being stored, you’ll have to manage each set of search indices multiple times when creating and deleting the main object to make sure you don’t have any orphaned objects laying around.

Is there not a way to handle this search by API?

All of the data is readily available.

The last time i checked with Bubble you couldnt use a search box with an API as a data source.