
qbe.byExample( example as Item ) as cts.query
This function transforms a query by example into a
cts.query
object.
| Parameters | |
|---|---|
| example | A query by example for matching JSON documents. |
To learn how to specify a query by example, see
Searching Using Query By Example in the Search Developer's Guide.
Important: The
byExample
function has the same limitations as the
jsearch.byExample function:
cts.query .
The returned cts.query can be passed to a
cts.search
call,
an Optic API
prototype.where
operation, or any other call that takes a
cts.query
object.
const qbe = require('/MarkLogic/appservices/search/qbe.xqy');
const query = qbe.byExample({
title:{$word: 'sawyer'},
$and:[
{price:{$ge: 8.00}},
{price:{$lt: 10.00}}
]
});
cts.search(query);
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.