jsearch.values( $index as cts.reference ) as ValuesSearch
Creates a ValuesSearch object to define and execute a search for a list of indexed values.
|$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.|
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.
// Query the values of the "title" JSON property in all documents // in the directory "/books". var jsearch = require('/MarkLogic/jsearch.sjs'); jsearch.values('title') .where(cts.directoryQuery('/books/')) .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"]