basho / riak-nodejs-client

The Riak client for Node.js.
Apache License 2.0
72 stars 28 forks source link

Riak Search, empty string "" becomes integer 0. [JIRA: CLIENTS-881] #160

Closed zhaohanweng closed 8 years ago

zhaohanweng commented 8 years ago

From the code it looks like isNaN is used to check the "" empty string, https://github.com/basho/riak-nodejs-client/blob/master/lib/commands/yokozuna/search.js#L98

But isNaN(""); // false: the empty string is converted to 0 which is not NaN. from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/isNaN.

lukebakken commented 8 years ago

Just so I understand, if a search returns a document whose value is the empty string, the value gets converted into an integer whose value is 0?

It seems like this check should be used instead.