[google-appengine] Re: help with google app engine search api

2015-08-04 Thread Sourabh Agrawal
*Thanks Mihail Russu*

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/b95e86b7-ebbf-4dfc-ab6a-da31ad2ff991%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[google-appengine] Re: help with google app engine search api

2015-08-04 Thread Sourabh Agrawal
*survey_marker = ndb.GeoPt(35.2, 40.5)*
*query = distance(survey_marker , geopoint(35.2, 40.5))  1*
*index = search.Index(name=myIndex)*
*search_results = index.search(query)*
*print search_results*
*for doc in search_results:*
*print doc*

I tried this but it always gives this result on exectuing : 

*search.SearchResults(number_found=0L)*


Also read an thread on this at stackoverflow which says it doesnt works on 
local machine.. so I deployed a test application but the result is no 
different. 
Plz help me with this.

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/6833f0fe-027f-40d2-b3c5-36631e5342ce%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[google-appengine] Re: help with google app engine search api

2015-08-04 Thread Mihail Russu
Did you add anything into your index before querying it? Can you see your 
data on the admin page (i.e. http://127.0.0.1:8000/search/index )? Can you 
show how you're indexing things?

Thanks,
Mihail.

On Tuesday, August 4, 2015 at 6:05:38 PM UTC+3, Sourabh Agrawal wrote:

 *survey_marker = ndb.GeoPt(35.2, 40.5)*
 *query = distance(survey_marker , geopoint(35.2, 40.5))  1*
 *index = search.Index(name=myIndex)*
 *search_results = index.search(query)*
 *print search_results*
 *for doc in search_results:*
 *print doc*

 I tried this but it always gives this result on exectuing : 

 *search.SearchResults(number_found=0L)*


 Also read an thread on this at stackoverflow which says it doesnt works on 
 local machine.. so I deployed a test application but the result is no 
 different. 
 Plz help me with this.



-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/4bf95a98-388b-4985-ba13-2c5a62fe3e98%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[google-appengine] Re: help with google app engine search api

2015-08-04 Thread Mihail Russu
The only required parameter of the `search.Index 
https://cloud.google.com/appengine/docs/python/search/indexclass` 
function is `name` which is normally a string, so it's safe to assume that 
`config.STORE_INDEX_NAME` simply stores the name of the index where you 
will be performing your search so you could've had something like 
`search.Index(name='my_index')` instead. Note that if you haven't 
previously added anything to that index  - the search will not return 
anything.

It looks like you're following the More Complex Search API Queries 
https://cloud.google.com/appengine/training/fts_adv/lesson1 tutorial 
which assumes you already have some basic familliarity with the Search API 
but if you don't, you should start with the Search API Basics 
https://cloud.google.com/appengine/training/fts_intro/lesson2 tutorial 
first which will explain you how to index your data first and then query it.

Thanks,
Mihail.

On Tuesday, August 4, 2015 at 9:06:04 AM UTC+3, Sourabh Agrawal wrote:

 Hey, 

 i am new to gaepython, I have been trying to find nearby areas to a given 
 location.. I found search api could do this, what i couldn't figure out is 
 that* what will be config.STORE_INDEX_NAME*. When is used this exact code 
 it says * NameError: name 'config' is not defined*


 from google.appengine.api import search

 query = distance(geopoint(35.2, 40.5), geopoint(35.2, 40.5))  100
 index = search.Index(config.STORE_INDEX_NAME)
 search_results = index.search(query)

 Thanks in advance



-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/e494b7e1-784e-46ac-87b8-16c25aa70aef%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[google-appengine] Re: help with google app engine search api

2015-08-04 Thread Sourabh Agrawal
survey_marker= ndb.GeoPt(35.1, 40.0)
d = search.Document(fields=survey_marker)
search.Index(name=locate_this).put(d)
query_obj= distance(survey_marker , geopoint(35.2, 40.5))  1
results = search.Index(name=locate_this).search(query=query_obj)
print results
for doc in results:
print doc

I wasnt indexing earlier. but as i have indexed now(hopefully it is right ) 
it returns TypeError: 'GeoPt' object is not iterable. btw I m doing this on 
interactive console

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/5f4b91b4-7fa7-4320-a89c-545106a45563%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[google-appengine] Re: help with google app engine search api

2015-08-04 Thread Mihail Russu
Your ndb.GeoPt part should probably look something like:

survey_marker = ndb.GeoPt(lat=35.1, lon=40.0)

Testing things in interactive console is perfectly normal.

Also, note that your index name needs to be persistent between your 
examples (it was myIndex in your previous message, locate_this in this 
one and as a variable locate_this (not a string)).

As per the tutorial I mentioned in my first response, the fields 
parameter of search.Document accepts a list of named fields, not just a 
field. Again, try going over the tutorial 
https://cloud.google.com/appengine/training/fts_intro/lesson2as it has 
answers to all of the issues you've had here so far.

Thanks,
Mihail.


On Tuesday, August 4, 2015 at 6:30:45 PM UTC+3, Sourabh Agrawal wrote:

 survey_marker= ndb.GeoPt(35.1, 40.0)
 d = search.Document(fields=survey_marker)
 search.Index(name=locate_this).put(d)
 query_obj= distance(survey_marker , geopoint(35.2, 40.5))  1
 results = search.Index(name=locate_this).search(query=query_obj)
 print results
 for doc in results:
 print doc

 I wasnt indexing earlier. but as i have indexed now(hopefully it is right 
 ) it returns TypeError: 'GeoPt' object is not iterable. btw I m doing 
 this on interactive console


-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/68f33c63-e31b-46d1-a923-e6ce1d1fe41a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.