Loading TOC...

WordsSearch.orderBy

WordsSearch.orderBy(
   direction as string
) as WordsSearch

Summary

Specifies the sort order for the words.

Parameters
direction Specifies whether to sort in "ascending" or "descending" order.

See Also

Example


// 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"]
*/
   

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.