インデックス レイヤーにデータを公開します

メタデータおよびデータは 、インデックス レイヤーでのバッチ処理用に最適化された方法でインデックス化および保存できます。

インデックス レイヤーにデータを公開するには、次の手順に従います。

  1. OlpClientSettings オブジェクトを作成します。

    手順については、「プラットフォームクライアント設定を作成する」を参照してください。

  2. IndexLayerClient ステップ 1 で設定したレイヤーとプラットフォームクライアントを含むカタログの HERE リソースネーム ( HERE リソースネーム )を使用してオブジェクトを作成します。

    auto client = olp::dataservice::write::IndexLayerClient(
    olp::client::HRN{kCatalogHRN}, client_settings);
    
  3. Index オブジェクトを作成します。

    Index index;
    std::map<IndexName, std::shared_ptr<IndexValue>> index_fields;
    index_fields.insert(std::pair<IndexName, std::shared_ptr<IndexValue>>(
        "Place",
        std::make_shared<StringIndexValue>("New York", IndexType::String)));
    index.SetIndexFields(index_fields);
    
  4. PublishIndexRequest 発行するデータ、レイヤー ID 、および手順 3 で作成したインデックスを使用して、オブジェクトを作成します。

    auto index_request = PublishIndexRequest()
                                         .WithIndex(index)
                                         .WithData(data)
                                         .WithLayerId(layer_id);
    
  5. PublishIndexDataRequest パラメーターを使用してメソッドを呼び出します。

    auto future = client.PublishIndex(index_request);
    
  6. PublishIndexResponse 未来を待っていてください。

    auto response = future.GetFuture().get();
    

PublishIndexResponse このオブジェクトは、完了した操作の詳細を保持し、操作の成功および結果のデータへのアクセスを判断するために使用されます。

  • IsSuccessful() –操作が成功した場合は、を返し trueます。 それ以外の場合は、を返します false
  • GetResult()–操作が成功すると、次の結果データが返されます。 olp::dataservice::write::PublishIndexResult
  • GetError()olp::client::ApiError オブジェクトのエラーの結果としてエラー情報が含まれます。
if (response.IsSuccessful()) {
    auto response_result = response.GetResult();
    // Handle success
} else {
    auto api_error = response.GetError();
    // Handle fail
}

」に一致する結果は 件です

    」に一致する結果はありません