Professional network app - search issues

Hello folks,

This is probably a known pain to many of you, yet I’ve come across people here who’ve never had to use an external database, so maybe they can shed light on my problem.

I’m working on a project that helps people from a similar professional sector share leads with each other.

The basic logical structure are user profiles with professional preferences such as geographical area etc, and the relationship between the users:

  1. Colleagues, i.e. people I know personally and invited to join my network
  2. Colleagues of colleagues (AKA in LinkedIn as 2nd).
  3. The rest of the users

When a user gets a lead that they cannot service or that they need to transfer to someone in their network who has more accurate expertise, they create a search ticket. The ticket is based on several properties, and the results should be divided to three categories:
Direct colleagues
Colleagues of colleagues

As this is an MVP, I would like to try and stay on Bubble without going to more robust databases or backends.

I built what I considered the best data structure for the requirements and populated it with 4500 users, which is more or less the KPI that shows we have product market fit and it’s worth investing in scaling.

The data structure is as follows:
User datatype, which contains a list of the direct colleagues.
Relationship datatype that has From and To fields of type user.

With 4500 users each able to connect to around 100 colleagues, the relationship table size is almost 500,000 records after I populated it with random connections.

To limit the size of the results as close to the database level as possible, I took someone’s advice and added privacy rules so users could only see their colleagues’ colleagues only.

Still, when I want to limit the results of a search to the Colleagues of Colleagues population, which is around 10,000 relationship records per user, the search times out.

This is the “Do search for users” on the Colleagues of Colleagues group:

The first 4 items are constraints related to professional preferences, and the 5th constraint makes sure the returned user population is only from the Colleagues of Colleagues population.

To test where the bottleneck is, I tried to create a state that would only return the relationships, which timed out as well.

I know this is a lot, but I would be grateful if you could find an issue with my architecture, search, or have ideas on how to further test and optimize.

Thanks in advance!


What does the Search for relationships look like?

I know you said you wouldn’t want to use external services, but I truly believe that Algolia is the perfect solution for you, in this specific situation.

1 Like

@adamhholmes I actually do not constrain the search for relationships because I limit them on the privacy rules level. There’re 10000 records they can see on average.

@nocodeventure If I don’t get a better solution here I’ll have to go there I guess…

The main concern is more about performance rather than finding a better solution :+1:


Bubbles db is not good for complex queries like this.

1 Like

I mean a better solution that will get me the performance I need…

Have you implemented Algolia? If so, which architecture would you recommend? Through the Zeroqode plugin or directly through Bubble?

You aren’t sharing the schema but I was just wondering if you could set up the data so that this search could have more equals instead of contains (at least for a MVP). I’ve found bubble to handle the # of records you’re talking about with multi-field searches IF I set it up as = or !=.

Thank you @code-escapee, however, I need to be able to work with multiple values, even for the MVP…

The free plugin :wink: from me

While you can implement thru bubble directly, it’s slower and not as easy to implement in my opinion.