Google App Engine の Search API を使用して、ドキュメントをテスト インデックスにインデックス付けしようとしています。Google App Engine の公式ドキュメントに記載されているコード サンプルを使用しています。しかし、以下のスニペットを実行しようとすると。経由でドキュメントを配置しようとすると、次のエラーが発生しますindex.put
。
スレッド「メイン」の例外 com.google.apphosting.api.ApiProxy$CallNotFoundException: API パッケージ「検索」または呼び出し「IndexDocument()」が見つかりませんでした。com.google.apphosting.api.ApiProxy$1.get(ApiProxy.java:179) com.google.apphosting.api.ApiProxy$1.get(ApiProxy.java:177) com.google.appengine.api.utils .FutureWrapper.get(FutureWrapper.java:88) at com.google.appengine.api.utils.FutureWrapper.get(FutureWrapper.java:88) at com.google.appengine.api.search.FutureHelper.getInternal(FutureHelper.java) :73) com.google.appengine.api.search.FutureHelper.quietGet(FutureHelper.java:32) で com.google.appengine.api.search.IndexImpl.put(IndexImpl.java:486) で test.service. SearchingService.indexADocument(SearchingService.java:52)
コード スニペットは次のとおりです。
IndexSpec indexSpec = IndexSpec.newBuilder().setName(indexName).build();
SearchService service = SearchServiceFactory.getSearchService(
SearchServiceConfig.newBuilder().setDeadline(10.0).setNamespace("geeky").build());
Index index = service.getIndex(indexSpec);
final int maxRetry = 3;
int attempts = 0;
int delay = 2;
while (true) {
try {
index.put(document); // ERROR!!!!!!!!!!
} catch (PutException e) {
if (StatusCode.TRANSIENT_ERROR.equals(e.getOperationResult().getCode())
&& ++attempts < maxRetry) { // retrying
Thread.sleep(delay * 1000);
delay *= 2; // easy exponential backoff
continue;
} else {
throw e; // otherwise throw
}
}
break;
}
}
Eclipse Kepler で appengine-java-sdk-1.9.18 を使用しています。コードをローカルの開発サーバーで実行するか、appspot でホストされている運用環境で実行するかは問題ではありません。同じエラーが発生します。私はすでに Eclipse で Google アカウントに認証されており、Eclipse を介してコードを本番環境にプッシュできます。誰もこのエラーを見たことがありますか?