Page 1 of 2

How to create an app search feature using Parse database as a backend?

Posted: Thu Oct 11, 2012 2:27 am
by Alex B

So I've uploaded a bunch of data into Parse for my mobile app backend, however in order to not overwhelm my users with so much data - how do I create my app so that the user can input a search term and only the data with the words in the search term is shown?

For example, I have over 3,500 entries in my Parse database but only 5 have the name "crown". I would like to have those 5 results show rather than all 3,500.

Any tips, suggestions or help would be greatly appreciated - thank you!

Respectfully,

Alex Brandt


How to create an app search feature using Parse database as a backend?

Posted: Thu Oct 11, 2012 3:02 am
by maxkatz

How to create an app search feature using Parse database as a backend?

Posted: Thu Oct 11, 2012 3:42 am
by Alex B

I guess I'm still not understanding how to structure the request parameters for the search query. I can pull up the data just fine in the testing environment and get a response but when I try doing a search - I still get the default response.

I've been trying to use the string query function: 'where={"name":{"$regex":"^[A-Z]\\d"}}'

I've attached some screenshots of the properties and request parameters. Image Image

How do I structure the request parameters?


How to create an app search feature using Parse database as a backend?

Posted: Thu Oct 11, 2012 4:02 am
by maxkatz

You don't need the "=" for limit and 1000 should be in the value column. You also don't need "=" for where. As for query, start with something simple like this:

code
'{"text":"John"}'
/code

repalce 'text' with a column name in your database.


How to create an app search feature using Parse database as a backend?

Posted: Thu Oct 11, 2012 4:23 am
by Alex B

repalce 'text' with a column name in your database.

AH. That helps so much. I though "text" was referring to the search term.

Thank you for the help!

Hmm, okay I've been fiddling around and I'm still not getting the correct response for the search query. (I also tried different variations of the query such as adding the parentheses, quotation marks, etc)

The column in my Parse database with the name field I want to search is titled: Parse_9192012

Image


How to create an app search feature using Parse database as a backend?

Posted: Thu Oct 11, 2012 4:35 am
by maxkatz

You need the brackets:
code
'{"Parse_9192012 ":"Jim"}'
/code


How to create an app search feature using Parse database as a backend?

Posted: Thu Oct 11, 2012 3:56 pm
by Alex B

When I put in the brackets, I get a test failed/error response. (I tried it with and without the quotations to see if that made a difference).

I'm kind of banging my head against the wall on this right now. If I could just figure this search query function to produce the proper results, I'll be done.

I've attached a screen shot of the error response.
Image


How to create an app search feature using Parse database as a backend?

Posted: Thu Oct 11, 2012 5:00 pm
by Jahmarley

Hi Alex.. this is what I have done... hope it helps u some how as it took me a while and loads of trial and error and research to get this working.

1... set parameters...
Image

2....

I created a search input field on the app and and under data mapping I mapped the input field to where...

Image

3... under same data mapping... I added the following by clicking on the add button (it now says change as per the above image)....

return '{"BusinessName": {"$regex":"'+value+'","$options":"i"}}';

(note business name is the name of my column in parse)

4.. I created a button to work with the search input field and added an event.. on click... invoke service.. the service was the one i created to connect to parse.

5... I used a list component to create the section on teh app where the results would be displayed...

Image

6... I mapped the results from parse to the list component...

Image

Not sure what u can take from these steps but hope it can help u some how


How to create an app search feature using Parse database as a backend?

Posted: Thu Oct 11, 2012 7:41 pm
by Alex B

Jahmarley, this part:

"3... under same data mapping... I added the following by clicking on the add button (it now says change as per the above image)....

return '{"BusinessName": {"$regex":"'+value+'","$options":"i"}}';

(note business name is the name of my column in parse)"

helped a lot! Thank you, my search query now works on my app!!!!!

Thank you so much for helping me solve this.


How to create an app search feature using Parse database as a backend?

Posted: Thu Oct 11, 2012 8:28 pm
by Jahmarley

Hey there Alex B...

My pleasure... I know the feeling trying to get that sorted.. lol.. just glad I was able to help... gl with your app.