Text Search api not working on my production app

114 views
Skip to first unread message

FastGeert

unread,
Sep 7, 2012, 11:42:48 AM9/7/12
to google-a...@googlegroups.com
Hi,

today I started using the Text Search API to create a search functionality in my app.

While everything works just fine on the dev server, whatever api call to the Text Search API results in an InvalidRequest exception on my production app.
remove ===> fails
search ===> fails
add ===> fails

Do I need to perform a special action to use the Text Search API in production or am I missing something else ?

Regards, Geert.

Ujjal

unread,
Sep 7, 2012, 11:50:28 AM9/7/12
to google-a...@googlegroups.com

Can u give some more details... Prob samle code that i can test to see?


> --
> You received this message because you are subscribed to the Google Groups "Google App Engine" group.
> To view this discussion on the web visit https://groups.google.com/d/msg/google-appengine/-/HyL1V1jn9dsJ.
> To post to this group, send email to google-a...@googlegroups.com.
> To unsubscribe from this group, send email to google-appengi...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.

Christina Ilvento

unread,
Sep 7, 2012, 1:30:33 PM9/7/12
to google-a...@googlegroups.com
Hi,
You don't need any special permissions to start using the experimental Search API. Could you provide your app-id or sample code? 


Thanks,
Christina

FastGeert

unread,
Sep 7, 2012, 3:00:11 PM9/7/12
to google-a...@googlegroups.com
Hi,

this is the code I wrote:

from google.appengine.api import search
SERVICE_INDEX = "__SERVICE_INDEX__"
SERVICE_LOCATION_INDEX = "__SERVICE_LOCATION_INDEX__"
....
svc_index = search.Index(name=SERVICE_INDEX)
loc_index = search.Index(name=SERVICE_LOCATION_INDEX)
# cleanup any previous index entry
email = service.email()
svc_index.remove([email])
cursor = search.Cursor()
while True:
    query = search.Query(query_string="service:%s" % email, options=search.QueryOptions(cursor=cursor, limit=10))
    search_result = loc_index.search(query)
    loc_index.remove([r.doc_id for r in search_result.results])
    if search_result.number_found != 10:
        break
    cursor = search_result.cursor
# re-add if necessary
sc, locs = get_search_config(service)
if not sc.enabled:
    return
svc_index.add(search.Document(doc_id=email,
    fields=[search.TextField(name='service', value=email),
            search.TextField(name='name', value=profile.name),
            search.TextField(name='description', value=profile.description),
            search.TextField(name='keywords', value=sc.keywords)]))

Tugdual Grall

unread,
Sep 7, 2012, 10:55:52 PM9/7/12
to google-a...@googlegroups.com
Could you confirm that your application use the High Replication datastore

The Search API does not work with the deprecated master/slave datastore

Tug
http://resultri.com

Amy Unruh

unread,
Sep 8, 2012, 9:27:40 PM9/8/12
to google-a...@googlegroups.com
hi,

I believe the issue may be with your index names, specifically the underscores.  Can you try defining them without the underscores, e.g.
SERVICE_INDEX = "SERVICE_INDEX"
SERVICE_LOCATION_INDEX = "SERVICE_LOCATION_INDEX"

and let me know if that works for you in production?

 -Amy


To view this discussion on the web visit https://groups.google.com/d/msg/google-appengine/-/8byLQD7kxUcJ.

Amy Unruh

unread,
Sep 9, 2012, 1:28:14 AM9/9/12
to google-a...@googlegroups.com
On 9 September 2012 11:27, Amy Unruh <am...@google.com> wrote:
hi,

I believe the issue may be with your index names, specifically the underscores.  

To follow up -- this is almost certainly the source of your problem.  Any name that is of the form __(.*)__ is considered reserved.  I've filed issues to document this restriction, and to improve the error reporting when there is an attempt to define such an index.
Thanks for reporting that.

FastGeert

unread,
Sep 9, 2012, 3:44:23 PM9/9/12
to google-a...@googlegroups.com, amyu+...@google.com
Hi Amy,

I can confirm your analysis. Removing the underscores from the index name did the trick.

Thnx for your help,

Regards, Geert.
Reply all
Reply to author
Forward
0 new messages