DocumentsSearch.slice( start as integer, end as integer ) as DocumentsSearch
Specifies a subsequence of matched, sorted, and filtered documents to retrieve. If unspecified, the slice defaults to the first 10 documents.
// Find documents containing the word "california" in the "title" // JSON property, and return the first 5 results. const jsearch = require('/MarkLogic/jsearch.sjs'); jsearch.documents() .where(cts.parse('title:california')) .slice(0,5) .result()
// Return 10 documents, beginning with the 20th result const jsearch = require('/MarkLogic/jsearch.sjs'); jsearch.documents() .slice(20,30) .result()
// Suppress inclusion of matched documents (or snippets) const jsearch = require('/MarkLogic/jsearch.sjs'); jsearch.documents() .where(cts.jsonPropertyValueQuery('author', 'Mark Twain')) .slice(0,0) .result() /* Result: Search results that contain an estimate, but no search metadata or matching documents. Output will be similar to the following: { results: null, estimate: 4 } */
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.