Skip to content

Instantly share code, notes, and snippets.

@kelp404
Last active December 12, 2015 08:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kelp404/4748457 to your computer and use it in GitHub Desktop.
Save kelp404/4748457 to your computer and use it in GitHub Desktop.
Remove all documents in text search (GAE)

##Remove all documents in text search (GAE) ###Python

# remove all documents in text search
doc_index = search.Index(name='TextSearch')
while True:
# Get a list of documents populating only the doc_id field and extract the ids.
document_ids = [document.doc_id for document in doc_index.list_documents(ids_only=True)]
if not document_ids:
break
# Remove the documents for the given ids from the Index.
doc_index.delete(document_ids)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment