A quasi solution for some Case-Insensitive searches in Bubble

Obviously, Bubble.io has generally refused to modify the ‘do a search for’ data source command to at least offer the user the chance to search database contents without regard to case.

But, depending on your implementation and need, there is a gerry-rigged way of almost accomplishing the impossible. It involves merging multiple searches together into a single list, all looking for an Input’s value in a slightly different context. The context’s are set by leveraging multiple Operators in your constraints field.

Generally, you need to merge three ‘Search for’ statements in a single ‘Data source’. Each sharing the same Constraint, with a different operator:
[Field] 'contains keywords' [input]'s [value]
[Field] 'contains' [input]'s [ value]
[Field] 'contains' [input]'s [value]:'Capitalized Words'

The ‘contains keywords’ operator is a case insensitive operator, but only looks for whole words. The ‘contains’ operator looks for exact matches of the lookup value, and is case sensitive. So, the third search’s operator uses the same ‘contains’ operator, but capitalizes each word of the lookup value by adding the :‘Capitalized Words’ return condition.

Your Data source then would read something like the following:
Search for [data type]s merged with Search for [data type]s merged with Search for [data type]s

In practical terms, that means if I am searching a Data Type for the term “elect”, if I am merging the above searches as described, I will be getting results like:

  • election,
  • Election,
  • electrical,
  • Electrical,
  • electoral,
  • Electoral

What it WON’T find is: “elEctrical” or any other instance where the case of the any letter except the first in each word is capitalized unless it was explicitly typed that way in the Input. However, I’ve found this method to return 90% or more of my intended results.

You can probably expand this method to use :‘uppercase’ and :‘lowercase’ and get even greater coverage, yet.

Added tip: since this will return a lot more results than possibly intended until the user starts typing, I like to set the initial search to return nothing and leverage changing the data type in the Conditional tab once a certain number of characters is reached in the input such as:
Input's value:number of characters ≥ 3

3 Likes