0

I have a set of fields indexed by GAE search and can get results thus:

options = search.QueryOptions(returned_fields=['ID', 'firstname', 'lastname']}
query = search.Query('firstname:moe')

This gets me results returned and I can access data in the two name fields. But ID isn't included. I've tried 'doc_id" as well.

How can I get each doc ID with each result?

Carl
  • 2,896
  • 2
  • 32
  • 50

1 Answers1

2

The doc_id isn't "just another field"; it's a separate attribute of the Document object. Try like this:

search_results = index.search(query);
for doc in search_result.results:
    d = doc.doc_id
Alan
  • 690
  • 3
  • 6