googleapis / googleapis/google-cloud-java

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

Abierto
#10,971 3 comentarios 0 reacciones 0 asignados Ver en GitHub
priority: p3 type: bug
Lenguaje dominante
Java
Estrellas
2.1k
Forks
1.2k
Merge medio
1 d 23 h
PR fusionados (30 d)
154

Descripción

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!

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.