Closed gurusrin closed 6 years ago
@gurusrin I didn't find any reference about the change from sort
to sort_field
in the IBM Cloud documentation. Could you please share the link where you found this info?
@emlaver, My code was failing for get_search_result() giving an unknown error. While checking the problem using HTTP URLs, I traced out that the problem was due to query parameter sort
. While searching the internet, I found a link (unfortunately, I forgot to bookmark that link) which suggested the use of sort_field
. When I tried the same out in HTTP URL, it worked out well.
Even I found that this has not been documented properly and has been misleading.
@gurusrin Could you please contact our support team via support@cloudant.com with your account name so we can further investigate? Thanks.
I don't think this was changed. more likely you specified an invalid value to 'sort' and got an error. When you switched to 'sort_field', you didn't get an error because we don't examine unknown parameters, but you wouldn't get the right sort order either.
Sorry for the late response. I have raised the issue with the Cloudant Support team and awaiting their response.
Upon working with the Cloudant Support, I found that the mistake was at my end. I had been assuming the sort field to be integer but actually it appeared to be a string field. After making the appropriate changes, the results are coming fine.
In the new version of the Cloudant, the
sort
parameter has been changed tosort_field
for searching using design documents. Therefore, this needs to be updated in_common_util.py
file accordingly, so that functionget_search_result()
is able to return the results properly.Current function call:
results = get_search_result(designDoc, indexName, sort = "myfield<number>")
Modification required as per new change:
results = get_search_result(designDoc, indexName, sort_field = "myfield<number>")