Class: Searcher

Searcher

new Searcher(recordType, batchSize, lowerBound, searchFilters, searchColumns) → {Upserter}

Searcher Class
Parameters:
Name Type Description
recordType string The string representing the record type
batchSize string The string representing the batch size
lowerBound string The string representing the lower bound internalid
searchFilters array The array containing search filter params
searchColumns array The array containing search column params
Source:
Returns:
A new instance of Searcher
Type
Upserter

Methods

appendResults(resultsBlock) → {null}

Concatenates the given result set onto the result list
Parameters:
Name Type Description
resultsBlock Array The array containing a set of results from Netsuite
Source:
Returns:
Type
null

buildFormulaSegment(field, comparison, value) → {String}

Generates a single comparison segment for a SQL formula
Parameters:
Name Type Description
field string The String repesenting the field
comparison string The String repesenting the comparison operator
value string The String repesenting the value
Source:
Returns:
The string representing the SQL function
Type
String

createSearchColumns() → {null}

Generates an nlobjSearchColumn for each set of params in rawSearchColumns and appends the generated filters to the search column list
Source:
Returns:
Type
null

createSearchFilters() → {null}

Iterates over `rawSearchFilters` calling generating an nlobjSearchFilter from each
Source:
Returns:
Type
null

executeSearch() → {null}

Loop to orchestrate the entire search process
Source:
Returns:
Type
null

extractLowerBound(resultsBlock) → {Number}

Retrieves the list of the last record from the given result set
Parameters:
Name Type Description
resultsBlock Array The array containing a set of results from Netsuite
Source:
Returns:
The number representing the id of the last-fetched record
Type
Number

generateFormula(formulaData) → {String}

Generates a SQL function filter from the given params
Parameters:
Name Type Description
formulaData object The object repesenting the formula params
Source:
Returns:
The string representing the SQL function
Type
String

generateLowerBoundFilter() → {null}

Generates an nlobjSearchFilter to start the search at the lower bound, then assigns that filter to the list of all filters
Source:
Returns:
Type
null

generateSortColumn() → {null}

Generates a search column to sort by internalid and appends it to the list of all search columns
Source:
Returns:
Type
null

getParams() → {object}

Generates a list of params given in the HTTP request
Source:
Returns:
The object representing the params from the HTTP request
Type
object

getSearchColumnObject(searchColumnData) → {nlobjSearchColumn}

Generates an nlobjSearchColumn with the given params
Parameters:
Name Type Description
searchColumnData object The object representing the search column params
Source:
Returns:
The generated search column
Type
nlobjSearchColumn

getSearchFilterObject(searchFilterData) → {nlobjSearchFilter}

Generates an nlobjSearchFilter with the given params
Parameters:
Name Type Description
searchFilterData object The object representing the search filter params
Source:
Returns:
The generated search filter
Type
nlobjSearchFilter

getSearchResults() → {Array}

Fetches a new set of results from Netsuite and accumulates them onto the result list
Source:
Returns:
The array of results fetched from Netsuite
Type
Array

isExecutionDone(resultsBlock) → {boolean}

Requests a block of results from Netsuite, updates the context and
Parameters:
Name Type Description
resultsBlock Array The array containing a set of results from Netsuite
Source:
Returns:
The boolean representing successful completion
Type
boolean

reply() → {object}

Generates a formatted reply containing the results of the search execution
Source:
Returns:
The object representing formatted reply
Type
object

searchIteration() → {null}

Requests a block of results from Netsuite, updates the context and accumulates the results to the result list
Source:
Returns:
Type
null

setFormula(searchFilterObject, formulaString) → {String}

Assigns a given SQL formula to a search filter
Parameters:
Name Type Description
searchFilterObject nlobjSearchFilter An nlobjSearchFilter instance
formulaString string The String representing the SQL formula
Source:
Returns:
The string representing the SQL function
Type
String

setSortColumn(A) → {null}

Sets the sort mastering of the given column
Parameters:
Name Type Description
A nlobjSearchcolumn search column
Source:
Returns:
Type
null

updateBoundAndFilter(resultsBlock) → {null}

Updates the context of the search iteration using the given result set
Parameters:
Name Type Description
resultsBlock Array The array containing a set of results from Netsuite
Source:
Returns:
Type
null