firebase - Indexing strings to make it easier to search -


i want implement searching without using 3rd party. current idea store different string lengths keys indexed quickly. i'd implement minimum of 3 string lengths , make sure string being searched lower case. instance data in firebase this:

{     users: {         matuserid: {             name: 'mathew'         }     },     search: {         mat: {             users: { matuserid: true }         },         ath: {             users: { matuserid: true }         },         the: {             users: { matuserid: true }         },         hew: {             users: { matuserid: true }         },         math: {             users: { matuserid: true }         },         athe: {             users: { matuserid: true }         },         thew: {             users: { matuserid: true }         },         mathe: {             users: { matuserid: true }         },         athew: {             users: { matuserid: true }         },         mathew: {             users: { matuserid: true }         },     } } 

i've made expandable if there's other things can searched share same search key. i'm confident work , fast (i have basic implementation check out) wondering if right way searching or if i'm off base. example if search word 'hew' low child nodes 'hew' , users , display them.

i disliked suggestion had since resulted in quite large dataset. algolia suggestion frank van puffelen work great except have far data free version @ moment. ended rolling being able search via start of strings , created seperate key store text in lower case. way search became quite simple query:

.orderbychild('searchlowercase').startat(query.tolowercase()).endat(query.tolowercase() + "\uf8ff") 

this suit needs.


Comments

Popular posts from this blog

serialization - Convert Any type in scala to Array[Byte] and back -

matplotlib support failed in PyCharm on OSX -

python - Matplotlib: TypeError: 'AxesSubplot' object is not callable -