Move complex search to backend

Hi there,
is there a best practice for moving complex searches from the client to the server? Currently I have a search with a slow filter / advanced search on the client side. I want to match database entries from the current user to other users entries in the same table. E.g. I have a entry for every hobby of the user. Currently I do search for the current user and its hobbies and intersect them with other users. I hope it is a little bit clear what I want :slight_smile:
I’ve tried to start a API Workflow, but I was unable to show the result in a repeating group.
Thank you for your hints.

When a page triggers an API Workflow is a one-way thing. It tells the backend to do something. You can’t add a next step and refer to it like Step 1's Search result for instance.

On the other hand, you could probably:

  1. trigger an API workflow.
  2. make the page watch some data’s field for a change.
  3. do something when the data changes.

That something could be to display a list created by that API Workflow.


Another idea is that you try to do your search natively. I would refactor my data structure following @petter 's recommendations: The Ultimate Guide to Bubble Performance - the new edition is out (now 210 pages!).

2 Likes

Hey Rico, thx for your reply. I understand :slight_smile:

If you don’t find a good/workable solution within bubbles ecosystem, using a custom built cloud environment could solve this issue for you and be lightning fast.

If that piques your interest, let’s chat!

Learn more

Need to have your database located in your region! Tired of struggling with Bubble or API’s? Need a little functionality that’s not available yet thru current market plugins? Experience your own bootcamp!

Are you ready to step-it-up or speed it along? Need some custom code or a plugin built? Contact me today to learn how to book a 1-on-1 session, get your plugin built, or yet freelance building support!

Office Hours:
Mon - Fri
9:00 AM - 5:00 PM

Send me a message today:
Jared@KnowCodeConsultants.com

This same question has bedeviled me and I haven’t yet found an answer via the forums. The list-to-list search (which needs an advanced filter and the intersect with function) is executed client side, so it’s not scalable.

In terms of moving it server side, I’m aware of 2 methods:

  1. Have the search execute via an API workflow (you can build the same advanced filter in there), and then have Bubble trigger the search and receive the results via the API connector, as though it was pulling data from an external source.

  2. Use an intersecting table and search based on that (this is more the standard database approach).

This is on my dev list to-dos and I am going down the road of #2 to see how it performs. I will post the outcome.

2 Likes

Hello Ed,

Can you tell me which solution you used?

I‘m trying your (1) but I‘m not sure how to trigger the search over the API workflow.

How did you made the intersecting database work?

Thank you very much for an answer!

I’ve moved onto other projects so I don’t have a recommendation yet. I’ve run both in small test cases, but not on my app which is more complex. Re: instructions on how to do it, both require longer explanations; if you do some digging in the forum you should be able to find more details.

I’ve finally gotten around to experimenting with #2. The outcome is that you can move a list-to-list search server side through this method, and it performs well, but you are very limited. The search has to be:

  • Find things that contain at least one of the items from the list.
  • This has to be the only search run on the data.

This is because to combine this joining table search with another joining table search, or a search on the main datatype, you need to use a nested search or intersect two or more searches. From building these searches and looking at Chrome’s dev tools, what I saw was:

  • With a nested search (a search within a search), Bubble will download the entire results of the nested search to the browser, and then filter the main search results through that client side.
  • With an intersected search, Bubble will download the entire results of both searches to the browser and find the intersects client side.

The above is true even if the searches you are combining are basic searches that individually would run server side. Also, for my app at least, these searches perform worse than the advanced filter.

So my only other avenues are: a) experimenting with #1 (which seems kind of hacky); b) moving the database outside of Bubble and just using Bubble as a front end; or c) waiting for Bubble to expand the types of searches that can be run server side.

1 Like