Skip to content

CloudantV1.postPartitionSearch does not return order field in Node.JS #1877

@PatrikHysky

Description

@PatrikHysky

Describe the bug

CloudantV1.postPartitionSearch method should return an order field with each result, containing the relevance score. This works when using the Python library, however, it does not work in Node.JS using @ibm-cloud/cloudant package.

To Reproduce

In Node.JS, create an API that uses CloudantV1.postPartitionSearch. The result is missing the order field. Example response in Node.JS:
{"totalRows":4,"bookmark":"g2wAAAA...","rows":[{"fields":{"FormNumber":"SG24-8573-00"},"id":"rb:SG24-8573-00"}...
Using the same database, same partition, same method and same query, an equivalent Python script correctly returns the order field for each result.
Example response in Python:
{'total_rows': 4, 'bookmark': 'g2wAAAA...', 'rows': [{'id': 'rb:SG24-8573-00', 'order': [0.910089373588562, 2766], 'fields': {'FormNumber': 'SG24-8573-00'}...

Expected behavior

As per Cloudant documentation:
The response to a search query includes an order field for each of the results. The order field is an array where the first element is the field or fields that are specified in the sort parameter.

Screenshots

Must gather (please complete the following information):

  • SDK version 0.12.7
  • Node.js Version 20
  • Name of service that you're trying to use: @ibm-cloud/cloudant in Node.JS
  • method CloudantV1.postPartitionSearch

Additional context

No workaround found using the Node.JS library. The order field is simply missing from the response.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions