Loading TOC...

jsearch.tuples

jsearch.tuples(
   $index as cts.reference
) as TuplesSearch

Summary

Creates a TuplesSearch object to define and execute a search for a list of rows where the values in each row co-occur in indexes for a document.

Parameters
$index An array of cts.reference objects for range indexes or other value lexicons (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.

Usage Notes

Use the methods of TuplesSearch to tailor your query. For example, scope your query to the values in documents matching a documents query, define a sort order, or compute an aggregate over the co-occurrences.

See Also

Example


// Find co-occurrences of the "author" and "format" JSON properties
// in documents in "/books/" directory.
var jsearch = require('/MarkLogic/jsearch.sjs');
jsearch.tuples(['author','format'])
  .where(cts.directoryQuery('/books/'))
  .orderBy('item')
  .result()

==> Co-occurence values similar to the following:

[["John Steinbeck", "audiobook"], ["John Steinbeck", "hardback"],
 ["John Steinbeck", "paperback"], ["Mark Twain", "hardback"], 
 ["Mark Twain", "paperback"], ["Robert Frost", "paperback"]]
   

Comments

    Powered by MarkLogic Server 7.0-4.1 and rundmc | Terms of Use | Privacy Policy