0

I want to search from firebase/firestore, with case insensitive in the sense Foo,foo or FOO can be searched directly without any case restriction. please if some one has any idea how to do.

  • Hi Ravikiran, there is already answers related to your question on SO. It seems that there is no way to do so, see here: https://stackoverflow.com/questions/38590937/firebase-query-methods-startat-taking-case-sensitive-parameters – Sinan Aug 20 '20 at 07:16

1 Answers1

0

I'm sorry to say but there is no direct way of case insensitive querying for firestore. But there is a workaround for this problem.

Consider this is your structure of data:

doc 1:
   field: 'Foo'

doc 2:
   field: 'FOO'

doc 3:
   field: 'foo'

You can convert that structure of data to this format:

doc 1:
   field: 'Foo'
   field_insensitive: 'foo'

doc 2:
   field: 'FOO'
   field_insensitive: 'foo'
doc 3:
   field: 'foo'
   field_insensitive: 'foo'

Using this format of data storing you can query for the firestore using the field field_insensitive.

Sushan Sapaliga
  • 324
  • 5
  • 14