googleapis / googleapis/google-cloud-java

[v1-google-cloud-discoveryengine]: Still receiving as gRpc struct even use HttpJsonTransportProvider

Đang mở
#10,971 3 bình luận 0 reaction 0 người được giao Xem trên GitHub
priority: p3 type: bug
Ngôn ngữ chính
Java
Star
2.1k
Fork
1.2k
Merge trung bình
1 ngày 23 giờ
Pull request đã merge (30 ngày)
154

Mô tả

First of all, I'm very new with this service google-cloud-discoveryengine.
I trying to call https://discoveryengine.googleapis.com/v1 for vertex search with client lib from google cloud and i want the result as json, btw i always receive struct which is not json response. So i go to read this documentation https://cloud.google.com/java/docs/reference/google-cloud-discoveryengine/latest/com.google.cloud.discoveryengine.v1.SearchServiceClient, they said that use
SearchServiceSettings searchServiceSettings = SearchServiceSettings.newHttpJsonBuilder().build();
but i still get struct response.

can u help me solve this problem? or tell me what i did wrong
this is my code

SearchServiceSettings searchServiceSettings = SearchServiceSettings.newHttpJsonBuilder().build();
try (SearchServiceClient searchServiceClient = SearchServiceClient.create(searchServiceSettings)) {
SearchRequest request =
SearchRequest.newBuilder()
.setServingConfig(
ServingConfigName.formatProjectLocationCollectionDataStoreServingConfigName(
projectId, location, collectionId, dataStoreId, servingConfigId))
.setSpellCorrectionSpec(
SearchRequest.SpellCorrectionSpec.newBuilder()
.setMode(SearchRequest.SpellCorrectionSpec.Mode.AUTO).build()
)
.setQueryExpansionSpec(
SearchRequest.QueryExpansionSpec.newBuilder()
.setCondition(SearchRequest.QueryExpansionSpec.Condition.AUTO).build()
)
.setQuery(searchQuery)
.setPageSize(1)
.build();
SearchServiceClient.SearchPagedResponse a = searchServiceClient.search(request);
SearchResponse response = a.getPage().getResponse();
List results = response.getResultsList();
SearchResponse.SearchResult res = results.getFirst();

this is some part of my response
```
results {
id: "1250"
document {
name: "projects/272270411648/locations/global/collections/default_collection/dataStores/mordee-doctor-info-test/branches/0/documents/1250"
id: "1250"
struct_data {
fields {
key: "availableChannels"
value {
list_value {
values {
string_value: "Video"
}
values {
string_value: "Voice"
}
}
}
}
fields {
key: "availableLanguages"
value {
list_value {
values {
string_value: "th-TH"
}
}
}
}
fields {
key: "certificate"
value {
struct_value {
fields {
key: "en"
value {
string_value: "Bachelor of Science Program in Food Technology and Nutrition, Mahasarakham University "
}
}
fields {
key: "th"
value {
string_value: "Master of Science Program in Food Technology, Khonkaen University "
}
}
}
}
}
```

note* i try v1, v1beta, and v1alpha already

Java Version: java 22.0.1
Quarkus Version: 3.11.1

Thanks!

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.