ResultSet.getRange(options)

Method Description

Retrieve a slice of the search result as an array of search.Result objects.

The start parameter is the inclusive index of the first result to return. The end parameter is the exclusive index of the last result to return. For example, getRange(0, 10) retrieves 10 search results, at index 0 through index 9. Unlimited rows in the result are supported, however you can only return 1,000 at a time based on the index values.

If there are fewer results available than requested, then the array will contain fewer than end - start entries. For example, if there are only 25 search results, then getRange(20, 30) will return an array of 5 search.Result objects.

If you specify a range for which there are no results, an empty array is returned. For example, if there are 25 search results, then getRange(30, 40) will return an empty array.

Returns

search.Result[]

Supported Script Types

Client and server scripts

For more information, see SuiteScript 2.x Script Types.

Governance

10 units

Module

N/search Module

Since

2015.2

Parameters
Note:

The options parameter is a JavaScript object.

Parameter

Type

Required / Optional

Description

options.start

number

required

Index number of the first result to return, inclusive.

options.end

number

required

Index number of the last result to return, exclusive.

Syntax
Important:

The following code sample shows the syntax for this member. It is not a functional example. For a complete script example, see N/search Module Script Samples.

          //Add additional code 
...
var results = rs.getRange({
    start: 0, 
    end: 1000
});
...
//Add additional code 

        

Related Topics

General Notices