Vij*_*ani 5 google-app-engine python-2.7 gae-search
result = search.get_indexes(namespace='', offset=0, limit=999, start_index_name='f35cef2dfb9a8f34e381386ec5a1f7ee', include_start_index=True, fetch_schema=False)
Run Code Online (Sandbox Code Playgroud)
但是,这里没有id/index
如何在Search API中只获取记录的id/index?救命 !!
小智 1
上面的代码只会为您提供第一批 doc_ids 我不得不花费几个小时才能找到它。使用以下代码获取所有 doc_ids...
from google.appengine.api import search
index = search.Index('YOUR_INDEX_NAME')
document_ids = [document.doc_id for document in index.get_range(start_id="0", ids_only=True)]
while len(document_ids)>1:
for doc_id in document_ids:
print doc_id# Do whatever you want with these ID's
document_ids = [document.doc_id for document in index.get_range(start_id=doc_id, ids_only=True)]
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
716 次 |
| 最近记录: |