Google app engine 确定是否存在搜索API索引
在我的业务逻辑中,我首先需要检查Appengine搜索API索引是否存在。如果存在,则确定长度Google app engine 确定是否存在搜索API索引,google-app-engine,full-text-search,Google App Engine,Full Text Search,在我的业务逻辑中,我首先需要检查Appengine搜索API索引是否存在。如果存在,则确定长度 for index in search.list_indexes(fetch_schema=False): if name == index.name: indexed = True 问题是没有返回整个列表。因此,我尝试了以下方法: for index in search.list_indexes(fetch_schema=False, limit=500): logg
for index in search.list_indexes(fetch_schema=False):
if name == index.name:
indexed = True
问题是没有返回整个列表。因此,我尝试了以下方法:
for index in search.list_indexes(fetch_schema=False, limit=500):
logging.info("sent name: " + name + " : official index name: " + index.name)
结果是,它将其限制为100个索引。我一定错过了什么
我的问题有两个方面:
有没有更好的方法来检查索引是否存在?我觉得我的方式不对
当我们显然有更多的索引时,为什么list_索引只能返回100
编辑:---------------------
根据@skreft的建议,我用以下内容更新了代码:
for index in search.list_indexes(fetch_schema=False, include_start_index=True, start_index_name="some_index", limit=1000):
logging.info("sent name: " + name + " : official index name: " + index.name)
if name == index.name:
indexed = True`enter code here`
但问题是我收到了一条非常隐秘的错误信息,我非常明确地遵循了文档。还有其他人发生过这种事吗?错误如下:
Traceback (most recent call last):
File "/base/data/home/apps/s~searchbertha-hrd/82.359784956262345840/models.py", line 1898, in build_searchable_index
for index in search.list_indexes(fetch_schema=False, include_start_index=True, start_index_name=name, limit=1000):
File "/base/python_runtime/python_lib/versions/1/google/appengine/api/search/search.py", line 675, in list_indexes
raise _ToSearchError(e)
InvalidRequest
尝试使用参数start\u index\u name和include\u start\u index
有关更多信息,请参阅。谢谢您的建议。我试过了,并编辑了上面的问题。我被一条非常神秘的信息难住了。想法?尝试将限制改为100。这对我很管用。另外,在您的情况下,我认为使用index\u name\u前缀更合适。