2012-05-24 160 views
0

執行index()時沒有statuscode返回值。remove(..)?但是index()。add(..)的狀態碼返回。如果刪除(..)失敗,沒有要求重試嗎?全文搜索刪除索引重試?

回答

1

Index.remove()如果出現問題應該會引發異常。具體來說(從remove方法文檔):

"Raises: 
    RemoveError: If one or more documents failed to remove or 
    number removed did not match requested. 
    ValueError: If document_ids is not a string or iterable of valid document 
    identifiers or number of document ids is larger than 
    _MAXIMUM_DOCS_PER_REQUEST." 
+0

對於java如何捕捉異常? – cometta

+0

對不起,錯過了你的問題是針對Java的。在這種情況下,您會捕獲RemoveException(https://developers.google.com/appengine/docs/java/javadoc/com/google/appengine/api/search/Index#remove(java.lang.String ...) –