Be the first to know! News, product information, and events delivered straight to your inbox.
Be the first to know! News, product information, and events delivered straight to your inbox.
Be the first to know! News, product information, and events delivered straight to your inbox.
Be the first to know! News, product information, and events delivered straight to your inbox.
Be the first to know! News, product information, and events delivered straight to your inbox.
DocumentsSearch.where( $queries as cts.query ) as DocumentsSearch
Specifies which documents to match based on the indexes over the documents.
Parameters | |
---|---|
$queries | One or an array of cts.query objects matching documents. Some helper functions such as cts.parse() and jsearch.byExample() return a cts.query object. |
Apply this method to the output from jsearch.documents
.
You can optionally follow it with "clauses" such as orderBy
slice
, or map
. Query results are not
generated until you call DocumentsSearch.result
.
You can construct the input queries using cts.parse
,
jsearch.byExample
, a cts.query constructor such as
cts.jsonPropertyWordQuery
or
cts.elementValueQuery
, or any other function that
returns a cts.query object.
// A documents query composed from a QBE, a string query, and a cts.query const jsearch = require('/MarkLogic/jsearch.sjs'); jsearch.documents() .where([ jsearch.byExample({author: 'Mark Twain'}), cts.parse('price LT 10', {price: cts.jsonPropertyReference('price')}), cts.directoryQuery('/books/')]) .orderBy('title') .slice(0,3) .result()
Comments