一次性获得所有搜索结果(存在风险,请谨慎)

function getAllSearchResult(searchObj) {
        var resultSet = [];
        var pagedData = searchObj.runPaged({ pageSize: 1000 });
        if (!pagedData || pagedData.count == 0) return '';
        //log.debug(pagedData.count, pagedData);
        for (var i = 0; i < pagedData.pageRanges.length; i++) {
            var page = pagedData.fetch({ index: i });
            //log.debug(page.count, page);
            for (var j = 0; j < page.data.length; j++) {
                resultSet.push(page.data[j])
            }
        }
        return resultSet;
    }
Last modified: 22/10/2024

Author

Comments

Write a Reply or Comment

Your email address will not be published.