0

How can i search Firebase for properties that contain a string?

e.g user post's have descriptions that might say

"a red t-shirt" "a blue belt" "a silver belt buckle"

How could I search each post for text that says "belt" to find everything that has been posted about belts.

It seems Firebase only has .equalTo(String) and not .contains(String)

Can anyone help?

Emil
  • 2,786
  • 20
  • 24
Nickmccomb
  • 1,467
  • 3
  • 19
  • 34
  • Firebase indeed supports `equalTo()` and `startAt()`/`endAt()` (with the combination of these you can build a "starts with" like operation). It does not support contains operations. – Frank van Puffelen Aug 22 '15 at 17:46
  • Thanks Frank! I understand why it has to be done the way described in your answer, i was just hoping there was a simpler way. Hopefully there will be a simpler way with the Firebase API in the future (although i'm guessing there won't be because I can't imagine a contains query being anything but expensive with NOSQL) Thank you. – Nickmccomb Aug 23 '15 at 05:03

0 Answers0