jsearch.tuples( index as cts.reference ) as TuplesSearch
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.
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.
// Find co-occurrences of the "author" and "format" JSON properties // in documents in "/books/" directory. const jsearch = require('/MarkLogic/jsearch.sjs'); jsearch.tuples(['author','format']) .where(cts.directoryQuery('/books/')) .orderBy('item') .result() /* 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"]] */
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.