How to sort searchQuery result in Nodejs

How can I sort this search result in descending order?

const qp = couchbase.SearchQuery.conjuncts([]);

 if (query) {
      qp.and(
        couchbase.SearchQuery.conjuncts(
          couchbase.SearchQuery.queryString(query)
        )
      );
    }

  const result = await cluster.searchQuery("test-search", qp, {
      limit,
      skip,
    });

Hey @chawki,

You should be able to do something like the following:

const result = await cluster.searchQuery('test-search', qp, {
  sort: couchbase.SearchSort.score(),
});

or alternatively something like:

const result = await cluster.searchQuery('test-search', qp, {
  sort: couchbase.SearchSort.field('name').descending(true),
});

Cheers, Brett