MarkLogic Server 11.0 Product Documentation
jsearch.collections

jsearch.collections(
   uris as xs.string
) as jsearch

Summary

Creates a jsearch object for searching within the scope of the union of one or more collections.

Parameters
uris One or an array of collection URIs. When you specify multiple URIs, a document is included if it is in at least one of the collections.

Usage Notes

When you use the jsearch object created by this method, it effectively appends a cts.collectionQuery to any where clause with which it used. To apply a collection constraint to a specify sub-query or to use boolean composition of collection queries (e.g. collection1 AND collection2), use an explicitly cts.collectionQuery instead of (or in addition to) this method.

See Also

Example


// Match documents in the "Classics" collection with author "Mark Twain"
const classics = require('/MarkLogic/jsearch.sjs').collections('Classics');
classics.documents()
  .where( classics.byExample({author: 'Mark Twain'}) )
  .result()
   

Example


// Find words in the "title" word lexicon that occur in documents
// in the "poetry" or "literature" collections.
const favorites = require('/MarkLogic/jsearch.sjs')
                  .collections(['poetry', 'literature']);
favorites.words('title').result()
   
Powered by MarkLogic Server | Terms of Use | Privacy Policy