-
Notifications
You must be signed in to change notification settings - Fork 553
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Specifying multiple returnFields values #450
Comments
I am not able to reproduce the problem. Can you please help try the following: In a new index, add a simple document with 2 or 3 fields, like the example in our document: {
"docId": "doc1",
"fields": {
"field2": {
"values": [{
"stringValue": "\u003chtml\u003ehelloworld\u003c/html\u003e",
"stringFormat": "HTML"
}]
},
"field1": {
"values": [{
"stringValue": "helloworld",
"stringFormat": "TEXT"
}, {
"timestampValue": "2014-08-18T21:19:55.000Z"
}, {
"numberValue": 10
}, {
"geoValue": "+40.6894,-074.0447"
}]
}
}
} Then try the search query to return all fields, 1 field or multiple fields. |
Hi Yirong.
That's what the URLs and responses are in the description of this issue. We have no fields specified and returned, "*" specified and all fields returned, and then one, two, and three fields specified but only one field returned. I just tried this again and I get the same behavior. Can you post the URL you are hitting, including the querystring, when specifying and returning multiple fields? We were told we need to use flat params, but perhaps we need to format the input differently? Only the last "returnFields" specified in the querystring is being returned from the search API. I would really like to see how you are specifying multiple "returnFields" values. |
Here is what I tried:
https://cloudsearch.googleapis.com/v1/projects/yyr-testapp/indexes/test2/documents -d '{"docId": "gcloud-ruby", "fields": {"summary": {"values": [{"stringValue": "Idiomatic Ruby client for Google Cloud Platform services.", "stringFormat": "TEXT"}]}, "title": {"values": [{"stringValue": "gcloud-ruby", "stringFormat": "TEXT"}]}, "description": {"values": [{"stringValue": "Gcloud is the official library for interacting with Google Cloud.", "stringFormat": "TEXT"}]}}}' {
https://cloudsearch.googleapis.com/v1/projects/yyr-testapp/indexes/test2/search?query=ruby {
{
{
{
{ |
Confirmed this works (when applied to this test case: googleapis/google-cloud-node#1012) |
Oh man, the following comment was supposed to be posted yesterday:
I have identified the cause for this in the gcloud-ruby code and will post a fix later today. Thank you very much for your help! |
To add more thanks in the mix, thank you @blowmage for catching this in the first place, since Node also had problems making a proper request. 👊 |
@stephenplusplus I should have some updated acceptance tests that will use returnFields and fieldExpressions either later today or early tomorrow. Keep an eye on #448. |
Faraday re-parses the URI provided to it, so make sure it is using the flat parameters setting. [fixes googleapis#450]
Faraday re-parses the URI provided to it, so make sure it is using the flat parameters setting. [fixes #450]
In #442 @yyr2015 wrote:
We can not specify returnFields, and set returnFields to a single value, but cannot set returnFields to multiple values. Only the last value is returned. The following are the requests made to the Search API and their responses. The requests are all authenticated with signet.
No fields specified and no fields returned
https://cloudsearch.googleapis.com/v1/projects/nodal-almanac-725/indexes/test/search?query=ruby
All fields specified (using "*") and all fields returned
https://cloudsearch.googleapis.com/v1/projects/nodal-almanac-725/indexes/test/search?query=ruby&returnFields=%2A
One field specified ("title") and one field returned
https://cloudsearch.googleapis.com/v1/projects/nodal-almanac-725/indexes/test/search?query=ruby&returnFields=title
Two fields specified ("title" and "description") but only one field ("description") returned
https://cloudsearch.googleapis.com/v1/projects/nodal-almanac-725/indexes/test/search?query=ruby&returnFields=title&returnFields=description
Three fields specified ("title", "description", "summary") but only one field ("summary") returned
https://cloudsearch.googleapis.com/v1/projects/nodal-almanac-725/indexes/test/search?query=ruby&returnFields=title&returnFields=description&returnFields=summary
(The nextPageToken values have been truncated.)
/cc @chrisnb and @yyr2015
The text was updated successfully, but these errors were encountered: