Forum Academy Marketplace Showcase Pricing Features

Is there a way to: Search "Any Field" but exclude certain fields that are private/sensitive?

I’m trying to create a search field that searches by “any field” in the user’s table, but clearly I don’t want that to include user’s email addresses or else someone could figure out all of the email addresses of users on our site.

Any way to do this? Would prefer to avoid using “filtered” or “advanced” since those are done client side which makes them too slow for our use case.

This might not be the most sexy or efficient solution, but I’ll mention it anyway in case there’s no other way: you could create a database type that mirrors the type you want to display, but without the sensitive fields.

Such as:

(Original field)
Name: John Doe (not sensitive)
Birth date: 10/25/1985 (not sensitive)
Email: [email protected] (sensitive)
Unique ID: 12345

(Mirror field)
User: 12345
Name: 12345’s Name
Birth date: 12345’s birth date

I haven’t done this, but it might do the trick.

Solution 2:
One thing I did to speed up searching for users, is to create a text field that contains relevant fields. Let’s say in an employee catalogue, that might be “Full name” “Position” and “Department”. So I’d create a search field that contained “John Doe, Marketing Manager, Communications Department”
The field is not visible to users, just a search term. I can’t say for sure as I don’t know the inner workings of Bubble, but I would imagine it is quicker than to search several fields.

Good ideas @petter.

Another idea is to setup privacy rules, so users don’t have access to those sensitive fields depending on their role or who the fields “belong to”. I think that search won’t look inside them if access is denied, it’d be an interesting test.

1 Like

Second this. This is the proper way of enforcing security at this level.

1 Like

That sounds like a more secure solution, thanks @mishav and @Scott, this could help me as well.

@sridharan.s : I’d love it if you update the thread after you’ve tested this, as it could prove valuable to other users (other users at this point being… well, me :slight_smile:)

I finished building the search yesterday, before I heard these smart solutions.

The approach I took was as follows:

  • Rather than using an auto-complete input, I used a regular input field with a RG showing the results because I needed to apply several filters.
  • I created a 2nd input field whose value was dyamically set to be equal to the input field, but with all lowercase inputs. I then matched this to fields in our database using :lowercase within filtered / advanced so that the search was case insensitive.
  • I set the search to be based on 3 fields and used the filtered / advanced option and saying the input should contain field x OR the input should contain field y, etc.
  • Since this only matches when the input matches the full length of the field in our database, I added a parameter that would truncate the field in our database to be the # of letters that had been input in the search field. So, if they typed in “sc” that would match to “scott” since it’d compare only the first 2 letters.

Here’s a screenshot if it’s helpful:

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.