##Remove all documents in text search (GAE) ###Python
Last active
December 12, 2015 08:59
-
-
Save kelp404/4748457 to your computer and use it in GitHub Desktop.
Remove all documents in text search (GAE)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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