Tuesday 16 January 2018

javascript - How to perform sql "LIKE" operation on firebase?

I am using firebase for data storage. The data structure
is like
this:



products:{

product1:{
name:"chocolate",
}
product2:{

name:"chochocho",

}
}



I
want to perform an auto complete operation for this data, and normally i write the query
like this:



"select name from
PRODUCTS where productname LIKE '%" + keyword +
"%'";


So, for my
situation, for example, if user types "cho", i need to bring both "chocolate" and
"chochocho" as result. I thought about bringing all data under "products" block, and
then do the query at the client, but this may need a lot of memory for a big database.
So, how can i perform sql LIKE
operation?



Thanks

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...