-
Notifications
You must be signed in to change notification settings - Fork 641
Closed
Description
I've been troubleshooting some gcloud-ruby issues connecting to the Cloud Search API. I've been looking at gcloud-node's implementation, and I can't get find a way to specify multiple returnFields values.
Here is my setup:
$ nodejs
> var gcloud = require('gcloud')(...);
undefined
> var search = gcloud.search();
undefined
> var index = search.index('test');
undefined
> var printSearchResults = function(err, documents) {
... if (err) {
..... console.log('there was an error');
..... console.log(err);
..... } else {
..... console.log('the search results were returned:');
..... console.log(documents);
..... }
... }
undefined
I can perform a simple search without specifying any returnFields values:
> index.search('ruby', printSearchResults);
undefined
> the search results were returned:
[ { metadata: {},
baseUrl: '/documents',
parent:
{ metadata: {},
baseUrl: '/indexes',
parent: [Object],
id: 'test',
createMethod: undefined,
create: undefined,
delete: undefined,
exists: undefined,
get: undefined,
getMetadata: undefined,
setMetadata: undefined },
id: 'gcloud-ruby',
createMethod: undefined,
setMetadata: undefined,
fields: {} } ]
undefined
And I can specify a single returnFields value:
> index.search({query: 'ruby', returnFields: '*'}, printSearchResults);
undefined
> the search results were returned:
[ { metadata: {},
baseUrl: '/documents',
parent:
{ metadata: {},
baseUrl: '/indexes',
parent: [Object],
id: 'test',
createMethod: undefined,
create: undefined,
delete: undefined,
exists: undefined,
get: undefined,
getMetadata: undefined,
setMetadata: undefined },
id: 'gcloud-ruby',
createMethod: undefined,
setMetadata: undefined,
fields: { summary: [Object], title: [Object], description: [Object] } } ]
undefined
The trouble I run into is specifying multiple values:
> index.search({query: 'ruby', returnFields: ['title', 'summary', 'description']}, printSearchResults);
undefined
> there was an error
{ errors: undefined,
code: 400,
message: 'Invalid JSON payload received. Unknown name "returnFields[1]": Cannot bind query parameter. Field \'returnFields[1]\' could not be found in request message.\nInvalid JSON payload received. Unknown name "returnFields[2]": Cannot bind query parameter. Field \'returnFields[2]\' could not be found in request message.\nInvalid JSON payload received. Unknown name "returnFields[0]": Cannot bind query parameter. Field \'returnFields[0]\' could not be found in request message.',
response: undefined }
undefined
>
Metadata
Metadata
Assignees
Labels
No labels