Constants that are used access the information contained in the results of a search.
The following code:
resultContext.getResults(
function (resultError, searchResult) {
if (resultError) {
// Handle error
} else {
console.log('Total items: ' + searchResult['totalItems'])
searchResult.items.forEach(function (item) {
console.log(' ' + item.output['HostInfo|ip_address'])
})
}
},
{limit: 10}
)
Can be rewritten to use ResultConstants
as follows:
resultContext.getResults(
function (resultError, searchResult) {
if (resultError) {
// Handle error
} else {
console.log('Total items: ' + searchResult[ResultConstants.TOTAL_ITEMS])
searchResult[ResultConstants.ITEMS].forEach(function (item) {
console.log(' ' + item[ResultConstants.ITEM_OUTPUT]['HostInfo|ip_address'])
})
}
},
{limit: 10}
)
- Source:
Members
(static) CURRENT_ITEM_COUNT
'Current item count' result key.
- Source:
(static) ITEM_COUNT
'Item count' result key.
- Source:
(static) ITEM_CREATED_AT
'Item created at' result key.
- Source:
(static) ITEM_ID
'Item id' result key.
- Source:
(static) ITEM_OUTPUT
'Item output' result key.
- Source:
(static) ITEMS
'Items' result key.
- Source:
(static) ITEMS_PER_PAGE
'Items per page' result key.
- Source:
(static) START_INDEX
'Start index' result key.
- Source:
(static) TOTAL_ITEMS
'Total items' result key.
- Source: