如何在使用GAE Search API时删除搜索索引中的文档?

时间:2012-09-06 23:35:42

标签: google-app-engine full-text-search google-search-api

我创建了一个搜索索引,用文档填充它,它按设计工作。现在我想使用开发控制台从索引中删除文档。

在这样做时,我收到了错误。

'Index' object has no attribute 'delete_documents'

完整的堆栈跟踪如下:

Traceback (most recent call last):
File "C:\Program Files\Google\google_appengine\lib\webapp2\webapp2.py", line 1536, in __call__
  rv = self.handle_exception(request, response, e)
      File "C:\Program Files\Google\google_appengine\lib\webapp2\webapp2.py", line 1530, in __call__
  rv = self.router.dispatch(request, response)
File "C:\Program Files\Google\google_appengine\lib\webapp2\webapp2.py", line 1278, in default_dispatcher
  return route.handler_adapter(request, response)
File "C:\Program Files\Google\google_appengine\lib\webapp2\webapp2.py", line 1102, in __call__
  return handler.dispatch()
File "C:\Program Files\Google\google_appengine\lib\webapp2\webapp2.py", line 572, in dispatch
return self.handle_exception(e, self.app.debug)
File "C:\Program Files\Google\google_appengine\lib\webapp2\webapp2.py", line 570, in dispatch
return method(*args, **kwargs)
File "C:\Program Files\Google\google_appengine\google\appengine\ext\admin\__init__.py", line 133, in xsrf_required_decorator
method(self)
File "C:\Program Files\Google\google_appengine\google\appengine\ext\admin\__init__.py", line 1766, in post
index.delete_documents(docs)
AttributeError: 'Index' object has no attribute 'delete_documents'

1 个答案:

答案 0 :(得分:1)

这似乎是一个错误。我建议你在external issue tracker创建一张票。我将创建一个内部的。

同时编辑文件C:\Program Files\Google\google_appengine\google\appengine\ext\admin\__init__.py的第1766行,将index.delete_documents(docs)替换为index.remove(docs)