WordsSearch.orderBy( direction as string ) as WordsSearch
Specifies the sort order for the words.
Parameters | |
---|---|
direction | Specifies whether to sort in "ascending" or "descending" order. |
// Find all words in the JSON property named "title". Return // the results in descending order. const jsearch = require('/MarkLogic/jsearch.sjs'); jsearch.words('title') .orderBy('descending') .result() /* Result: The last 10 words in the lexicon ["Wrath", "Works", "Tom", "The", "Southern", "Sites", "Secret", "Sawyer", "Sacred", "Of"] */