Skip to main content

What's New in MarkLogic 11

Default Search Result Slice is Zero-Based

Previously, the slice clause on search (queryBuilder.slice) accepted a one-based starting position and a page length:

slice(oneBasedStart,PageLength)

As of MarkLogic 9 and Node.js Client API v2.0.0, queryBuilder.slice clause behaves like Array.prototype.slice. That is, it takes a zero-based starting position and the (zero-based) position after the last result to be retrieved. For example, the following slice call returns the first 5 results:

... .slice(0,5) ...

Also, you could previously use slice(0) to suppress the return of result documents and just retrieve an abbreviated summary. Now, you must include both the start and end positions for the same effect. For example: slice(0,0).

To restore the legacy behavior, use marklogic.setSliceMode. Note, however, that this form is deprecated and will be removed in a later release.

Note

The semantics of valuesBuilder.slice are unchanged. This function still accepts as 1-based starting position and a page length.