[Solved] Creating A Search By Name Function

I want to implement a function that takes a user’s input from a search box and cross-references it with the ‘name’ field in the products database. If a match is found, the layout of the repeating group display will be updated. The product matching the user’s input should be positioned at the top of the list in the repeating group.

How can I implement a function like this?

Searchbox element:

Repeating group element:

Products database:

Current Version:

Have you tried. Do a search for filtered (advanced → this elements name is this input value)?

Thanks for the fast reply.

I haven’t tried this yet.

It’s one of the biggest revelations in bubble. But it’s a bad method for big databases.

No need to use any client-side filtering for this…

Just add a constraint directly to your search (unique ID is searchbox’s value’s unique ID)

2 Likes

I managed to resolve the issue. Thanks

Another way to do this is:

  • Change the Search element by a Input element
  • Add a constraint to your Repeating Group: “name contains keyword(s) input’s value”
  • Check “Ignore empty constrains” option (to return all products when the input is empty).

That’s what I did! Thanks for your help.

Advanced filters are a last resort… chances are a slight change to data structure means they can avoided.

3 Likes

I know one solution was posted already, but just going to add what I consider the best solution.

Use the search box element as I believe you are from original post. Data type is Product, field to search is name.

In RG that has content type of Product put a conditional for when search box value is not empty and property to change is data source. The data source will be searcbox value converted to list.

No extra searches required.

2 Likes

Thank you for the suggestion. I will adopt this approach going forward.