Loading TOC...

jsearch.values

jsearch.values(
   index as cts.reference
) as ValuesSearch

Summary

Creates a ValuesSearch object to define and execute a search for a list of indexed values.

Parameters
index A cts.reference object for a range index or other value lexicon (such as those for uris or collections). As a shortcut, you can pass the name of a JSON property with a range index as a string. You can also pass an array of cts.reference objects or strings for a union of values lists.

Usage Notes

Use the methods of ValuesSearch to further refine your query, including scoping the values to those occurring in documents that match a documents search, defining a sort order, or computing an aggregate over the values.

See Also

Example


// Query the values of the "title" JSON property in all documents
// in the directory "/books".
const jsearch = require('/MarkLogic/jsearch.sjs');
jsearch.values('title')
  .where(cts.directoryQuery('/books/'))
  .result()

/* Result: A list of values from the "title" element range index that satisfy
    the query, similar to the following:

["Adventures of Huckleberry Finn", 
 "Adventures of Tom Sawyer", 
 "Collected Works", 
 "East of Eden", 
 "Of Mice and Men", 
 "The Grapes of Wrath"]
*/
  

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