Victor Balan
Victor Balan

Reputation: 1482

Marklogic 8 nodejs queryBuilder.orderBy SEARCH-BADORDERBY

I get this

SEARCH-BADORDERBY: (err:FOER0000) Indexes are required to support element, element-attribute, json-property, or field sort specifications

everytime i try to use the orderBy. I tried in all possible ways.

qb.where(qb.value("hasGeolocation", true)).orderBy("username")

or

qb.where(qb.value("hasGeolocation", true)).orderBy(qb.property("username"))

or

qb.where(qb.value("hasGeolocation", true)).orderBy(qb.sort("username"))

or

qb.where(qb.value("hasGeolocation", true)).orderBy(qb.sort(qb.property("username")))

and for the sort i tried with 'ascending' or 'descending' direction. Nothing works. Am I doing something wrong or is there something wrong with the MarkLogic Node Api?

Upvotes: 1

Views: 288

Answers (1)

Dave Cassel
Dave Cassel

Reputation: 8422

Victor, it looks to me like you haven't defined a range index on "username". Define a string range index on "username" and I think you'll be set.

Upvotes: 4

Related Questions