SolrQuery
cdf.queries. SolrQuery
Static
Class that represents a Solr query. This class will be registered globally using the static dashboard function registerGlobalQuery
.
The constructor of this class is created dynamically and registered in the dashboard query container queryFactories
.
To create a new Solr query use the dashboard function getQuery
.
**Source:**queries/SolrQuery.js, line 63
Extends
cdf.queries.BaseQuery
Example
dashboard.addDataSource("mySolrQuery", {
queryType: "solr",
endpoint: "http://some.domain/solr",
collection: "solr_collection",
requestHandler: "select",
responseType: "json",
solrQuery: "*:*"
});
dashboard.getQuery({dataSource: "mySolrQuery"}).doQuery(successCallback, errorCallback);
Members
_label : string
Gets the Solr Query class label.
_name : string
Gets the Solr Query class name
dashboard : cdf.dashboard.Dashboard
Protected
A reference to the dashboard instance.
deepProperties : Array.<`string`>
Constant Protected
A list of properties to be extended to the registered queries.
defaults : Object
Protected
The default properties.
interfaces : Object
Protected
The default interfaces.
Methods
buildQueryDefinition(overrides)
Builds the query definition object
.
dispose()
Dispose the query object.
doQuery(successCallback, errorCallback)
Executes a server-side query.
exportData()
Exports the data represented by the query.
fetchData(params, successCallback, errorCallback) : Object
Fetches the data.
getErrorHandler(callback) : function
Gets the error callback handler.
getOption(prop) : Object
Gets an option (fallback for when the OptionManager is not available).
getPage(targetPage, outsideCallback) : boolean
| Object
Gets the set of results for the page at index targetPage
(0-indexed).
getParameterMacros(overrides) : object
Gets the object containing the key/value pair of the parameters macros used in Solr Query Request.
getSolrQueryParameters() : object
Gets Solr's Query Parameters, which hold the Solr query specification.
getSuccessHandler(callback) : function
Gets the success callback handler.
init(opts)
Initialization function.
initPage(pageSize, outsideCallback) : boolean
| Object
Sets the page size and gets the first page of results.
lastProcessedResults() : Object
Gets the last retrieved result after being processed by postFetch.
lastResults() : Object
Gets the last retrieved result.
nextPage(outsideCallback) : Object
Gets the next page of results, as controlled by the pageSize
option.
pageStartingAt(page, outsideCallback) : boolean
| Object
Runs the query, setting a starting page before doing so.
previousPage(outsideCallback) : Object
Gets the previous page of results, as controlled by the pageSize
option.
reprocessLastResults(outerCallback) : Object
Reruns the success callback on the last retrieved result set from the server.
reprocessResults(outsideCallback) : Object
Alias for reprocessLastResults
.
setAjaxOptions(newOptions)
Sets the jQuery.ajax options for the query.
setCallback(callback)
Sets the success callback for the query.
setErrorCallback(callback)
Sets the error callback for the query.
setOption(prop, value)
Sets an option (fallback for when the OptionManager is not available).
setPageSize(pageSize)
Sets the page size.
setPageStartingAt(targetPage) : boolean
Sets the starting page for later executions of the query.
setParameters(params)
Sets query parameters.
setSearchPattern(pattern)
Sets the search pattern for the query.
setSortBy(sortBy)Abstract
Sets the sorting options.
sortBy(sortBy, outsideCallback)Abstract
Sorts the data and executes a callback.
Members Details
_label: string
Gets the Solr Query class label.
**Source:**queries/SolrQuery.js, line 112
**Overrides:**cdf.queries.BaseQuery#_label
_name: string
Gets the Solr Query class name
**Source:**queries/SolrQuery.js, line 101
**Overrides:**cdf.queries.BaseQuery#_name
dashboard: cdf.dashboard.Dashboard
Protected
A reference to the dashboard instance.
**Source:**queries/BaseQuery.js, line 76
Inherited From: cdf.queries.BaseQuery#dashboard
deepProperties: Array.<`string`>
Constant Protected
A list of properties to be extended to the registered queries that do not provide their own constructor function.
**Source:**queries/BaseQuery.js, line 67
Inherited From: cdf.queries.BaseQuery#deepProperties
Default Value:
`["defaults","interfaces"]`
See also:registerQuery
defaults: Object
Protected
The default properties.
successCallback : function
Default success callback.
errorCallback : function
Default error callback.
lastResultSet : Object
null
The last resultset returned by the query.
lastProcessedResultSet : Object
null
The last resultset returned by the query and processed.
page : number
0
The page number.
pageSize : number
0
The page size.
params : Object
{}
The query parameters.
ajaxOptions : Object
{async:false,type:"POST"}
The jQuery.ajax options for the query.
url : string
""
The target URL.
**Source:**queries/BaseQuery.js, line 94
**Overrides:**cdf.queries.BaseQuery#defaults
Name
Default Value
Description
successCallback : function
Default success callback.
errorCallback : function
Default error callback.
lastResultSet : Object
null
The last resultset returned by the query.
lastProcessedResultSet : Object
null
The last resultset returned by the query and processed.
page : number
0
The page number.
pageSize : number
0
The page size.
params : Object
{}
The query parameters.
ajaxOptions : Object
{async:false,type:"POST"}
The jQuery.ajax options for the query.
url : string
""
The target URL.
interfaces: Object
Protected
The default interfaces.
Name
Default Value
Description
params : Object
Parameter interfaces.
reader : string
"propertiesObject"
Parameter reader.
validator : string
"isObjectOrPropertiesArray"
Parameter validator.
Name
Default Value
Description
reader : string
"propertiesObject"
Parameter reader.
validator : string
"isObjectOrPropertiesArray"
Parameter validator.
successCallback : Object
Success callback interfaces.
validator : string
"isFunction"
Success callback validator.
Name
Default Value
Description
validator : string
"isFunction"
Success callback validator.
errorCallback : Object
Error callback interfaces.
validator : string
"isFunction"
Error callback validator.
Name
Default Value
Description
validator : string
"isFunction"
Error callback validator.
pageSize : Object
Page size interfaces.
validator : string
"isPositive"
Page size validator.
Name
Default Value
Description
validator : string
"isPositive"
Page size validator.
**Source:**queries/BaseQuery.js, line 138
Inherited From: cdf.queries.BaseQuery#interfaces
Name
Default Value
Description
params : Object
Parameter interfaces.
reader : string
"propertiesObject"
Parameter reader.
validator : string
"isObjectOrPropertiesArray"
Parameter validator.
Name
Default Value
Description
reader : string
"propertiesObject"
Parameter reader.
validator : string
"isObjectOrPropertiesArray"
Parameter validator.
successCallback : Object
Success callback interfaces.
validator : string
"isFunction"
Success callback validator.
Name
Default Value
Description
validator : string
"isFunction"
Success callback validator.
errorCallback : Object
Error callback interfaces.
validator : string
"isFunction"
Error callback validator.
Name
Default Value
Description
validator : string
"isFunction"
Error callback validator.
pageSize : Object
Page size interfaces.
validator : string
"isPositive"
Page size validator.
Name
Default Value
Description
validator : string
"isPositive"
Page size validator.
## Methods Details
buildQueryDefinition(overrides)
Builds the query definition object
.
**Source:**queries/BaseQuery.js, line 217
**Overrides:**cdf.queries.BaseQuery#buildQueryDefinition
overrides : object
Optional
Options that override the existing ones.
Name
Default Value
Summary
overrides : object
Optional
Options that override the existing ones.
dispose()
Dispose the query object.
**Source:**queries/BaseQuery.js, line 668
Inherited From: cdf.queries.BaseQuery#dispose
doQuery(successCallback, errorCallback)
Executes a server-side query.
**Source:**queries/BaseQuery.js, line 268
Inherited From: cdf.queries.BaseQuery#doQuery
successCallback : function
Optional
Success callback.
errorCallback : function
Optional
Error callback.
Name
Default Value
Summary
successCallback : function
Optional
Success callback.
errorCallback : function
Optional
Error callback.
exportData()
Exports the data represented by the query.
**Source:**queries/BaseQuery.js, line 289
**Overrides:**cdf.queries.BaseQuery#exportData
fetchData(params, successCallback, errorCallback) : Object
Fetches the data.
**Source:**queries/BaseQuery.js, line 350
Inherited From: cdf.queries.BaseQuery#fetchData
params : Object
Parameters for the query.
successCallback : function
Success callback.
errorCallback : function
Error callback.
Object
The result of calling doQuery
with the specified arguments.
InvalidInput
If the arguments are not correct.
Name
Default Value
Summary
params : Object
Parameters for the query.
successCallback : function
Success callback.
errorCallback : function
Error callback.
Name
Description
Object
The result of calling doQuery
with the specified arguments.
Name
Description
InvalidInput
If the arguments are not correct.
getErrorHandler(callback) : function
Gets the error callback handler that executes the provided callback when the query fails to execute.
**Source:**queries/BaseQuery.js, line 253
Inherited From: cdf.queries.BaseQuery#getErrorHandler
callback : function
Callback to call if the query fails.
function
Error callback handler.
Name
Default Value
Summary
callback : function
Callback to call if the query fails.
Name
Description
function
Error callback handler.
getOption(prop) : Object
Gets an option (fallback for when the OptionManager is not available).
**Source:**queries/BaseQuery.js, line 183
Inherited From: cdf.queries.BaseQuery#getOption
prop : string
The property from where to get the options.
Object
Value for the option.
Name
Default Value
Summary
prop : string
The property from where to get the options.
Name
Description
Object
Value for the option.
getPage(targetPage, outsideCallback) : boolean
| Object
Gets the set of results for the page at index targetPage
(0-indexed).
**Source:**queries/BaseQuery.js, line 580
Inherited From: cdf.queries.BaseQuery#getPage
targetPage : number
Index of the page to get, starting at index 0.
outsideCallback : function
Success callback to execute when the page is retrieved.
boolean
| Object
false
if the page is already the current one, otherwise returns the result of calling doQuery
.
InvalidPage
If targetPage
is not a positive number.
Name
Default Value
Summary
targetPage : number
Index of the page to get, starting at index 0.
outsideCallback : function
Success callback to execute when the page is retrieved.
Name
Description
boolean
| Object
false
if the page is already the current one, otherwise returns the result of calling doQuery
.
Name
Description
InvalidPage
If targetPage
is not a positive number.
getParameterMacros(overrides) : object
Gets the object containing the key/value pair of the parameters macros used in Solr Query Request.
**Source:**queries/SolrQuery.js, line 130
overrides : object
Optional
New query parameters to override any existing query parameters.
object
The macros' values in the request.
Name
Default Value
Summary
overrides : object
Optional
New query parameters to override any existing query parameters.
Name
Description
object
The macros' values in the request.
getSolrQueryParameters() : object
Gets Solr's Query Parameters, which hold the Solr query specification.
**Source:**queries/SolrQuery.js, line 157
object
The Solr Query Parameters.
Name
Description
object
The Solr Query Parameters.
getSuccessHandler(callback) : function
Gets the success callback handler that executes the provided callback when the query executes successfully.
**Source:**queries/BaseQuery.js, line 230
**Overrides:**cdf.queries.BaseQuery#getSuccessHandler
callback : function
Callback to call after the query is successful.
function
Success callback handler.
Name
Default Value
Summary
callback : function
Callback to call after the query is successful.
Name
Description
function
Success callback handler.
init(opts)
Initialization function.
**Source:**queries/BaseQuery.js, line 206
**Overrides:**cdf.queries.BaseQuery#init
opts : Object
The query definition options.
Name
Default Value
Summary
opts : Object
The query definition options.
initPage(pageSize, outsideCallback) : boolean
| Object
Sets the page size and gets the first page of results.
**Source:**queries/BaseQuery.js, line 652
Inherited From: cdf.queries.BaseQuery#initPage
pageSize : number
Page Size.
outsideCallback : function
Success callback to execute after query is retrieved.
boolean
| Object
false
if pageSize is invalid, otherwise the result of calling doQuery
.
InvalidPageSize
If the page size is not a positive number.
Name
Default Value
Summary
pageSize : number
Page Size.
outsideCallback : function
Success callback to execute after query is retrieved.
Name
Description
boolean
| Object
false
if pageSize is invalid, otherwise the result of calling doQuery
.
Name
Description
InvalidPageSize
If the page size is not a positive number.
lastProcessedResults() : Object
Gets the last retrieved result after being processed by postFetch.
**Source:**queries/BaseQuery.js, line 432
Inherited From: cdf.queries.BaseQuery#lastProcessedResults
Object
A deep copy of the the last result set obtained from the server after being processed by postFetch.
NoCachedResults
If there have not been previous calls to the server.
Name
Description
Object
A deep copy of the the last result set obtained from the server after being processed by postFetch.
Name
Description
NoCachedResults
If there have not been previous calls to the server.
lastResults() : Object
Gets the last retrieved result.
**Source:**queries/BaseQuery.js, line 416
Inherited From: cdf.queries.BaseQuery#lastResults
Object
A deep copy of the last result set obtained from the server.
NoCachedResults
If there have not been previous calls to the server.
Name
Description
Object
A deep copy of the last result set obtained from the server.
Name
Description
NoCachedResults
If there have not been previous calls to the server.
nextPage(outsideCallback) : Object
Gets the next page of results, as controlled by the pageSize
option.
**Source:**queries/BaseQuery.js, line 534
Inherited From: cdf.queries.BaseQuery#nextPage
outsideCallback : function
Success callback to execute when the next page of results is retrieved.
Object
The result of calling doQuery
.
InvalidPageSize
If the page size option is not a positive number.
Name
Default Value
Summary
outsideCallback : function
Success callback to execute when the next page of results is retrieved.
Name
Description
Object
The result of calling doQuery
.
Name
Description
InvalidPageSize
If the page size option is not a positive number.
pageStartingAt(page, outsideCallback) : boolean
| Object
Runs the query, setting a starting page before doing so. If the starting page matches the already selected one, the query run is canceled and false
is returned.
**Source:**queries/BaseQuery.js, line 624
Inherited From: cdf.queries.BaseQuery#pageStartingAt
page : number
Starting page index.
outsideCallback : function
Success callback to execute after the server-side query is processed.
boolean
| Object
false
if the query run is canceled, otherwise the result of calling doQuery
.
Name
Default Value
Summary
page : number
Starting page index.
outsideCallback : function
Success callback to execute after the server-side query is processed.
Name
Description
boolean
| Object
false
if the query run is canceled, otherwise the result of calling doQuery
.
previousPage(outsideCallback) : Object
Gets the previous page of results, as controlled by the pageSize
option.
**Source:**queries/BaseQuery.js, line 555
Inherited From: cdf.queries.BaseQuery#previousPage
outsideCallback : function
Success callback to execute when the previous page of results is retrieved.
Object
The result of calling doQuery
.
AtBeginning
If current page is the first one.
Name
Default Value
Summary
outsideCallback : function
Success callback to execute when the previous page of results is retrieved.
Name
Description
Object
The result of calling doQuery
.
Name
Description
AtBeginning
If current page is the first one.
reprocessLastResults(outerCallback) : Object
Reruns the success callback on the last retrieved result set from the server.
**Source:**queries/BaseQuery.js, line 449
Inherited From: cdf.queries.BaseQuery#reprocessLastResults
outerCallback : function
Success callback.
Object
The result of calling the specified callback.
NoCachedResults
If there have not been previous calls to the server.
See also:reprocessResults
Name
Default Value
Summary
outerCallback : function
Success callback.
Name
Description
Object
The result of calling the specified callback.
Name
Description
NoCachedResults
If there have not been previous calls to the server.
reprocessResults(outsideCallback) : Object
Alias for reprocessLastResults
.
**Source:**queries/BaseQuery.js, line 474
Inherited From: cdf.queries.BaseQuery#reprocessResults
outsideCallback : function
Success callback.
Object
The result of calling the specified callback.
NoCachedResults
If there have not been previous calls to the server.
See also:reprocessLastResults
Name
Default Value
Summary
outsideCallback : function
Success callback.
Name
Description
Object
The result of calling the specified callback.
Name
Description
NoCachedResults
If there have not been previous calls to the server.
setAjaxOptions(newOptions)
Sets the jQuery.ajax options for the query.
**Source:**queries/BaseQuery.js, line 299
Inherited From: cdf.queries.BaseQuery#setAjaxOptions
newOptions : Object
Ajax options to be added.
Name
Default Value
Summary
newOptions : Object
Ajax options to be added.
setCallback(callback)
Sets the success callback for the query.
**Source:**queries/BaseQuery.js, line 494
Inherited From: cdf.queries.BaseQuery#setCallback
callback : function
The success callback function.
Name
Default Value
Summary
callback : function
The success callback function.
setErrorCallback(callback)
Sets the error callback for the query.
**Source:**queries/BaseQuery.js, line 504
Inherited From: cdf.queries.BaseQuery#setErrorCallback
callback : function
The error callback function.
Name
Default Value
Summary
callback : function
The error callback function.
setOption(prop, value)
Sets an option (fallback for when the OptionManager is not available).
**Source:**queries/BaseQuery.js, line 194
Inherited From: cdf.queries.BaseQuery#setOption
prop : string
The property for which the value will be set.
value : Object
Value for the property.
Name
Default Value
Summary
prop : string
The property for which the value will be set.
value : Object
Value for the property.
setPageSize(pageSize)
Sets the page size.
**Source:**queries/BaseQuery.js, line 638
Inherited From: cdf.queries.BaseQuery#setPageSize
pageSize : number
Page size to set.
Name
Default Value
Summary
pageSize : number
Page size to set.
setPageStartingAt(targetPage) : boolean
Sets the starting page for later executions of the query.
**Source:**queries/BaseQuery.js, line 602
Inherited From: cdf.queries.BaseQuery#setPageStartingAt
targetPage : number
Index of the page to get.
boolean
true
if the page is correctly set, false
if the target page is already the selected one.
InvalidPage
If the page number is not a positive number.
Name
Default Value
Summary
targetPage : number
Index of the page to get.
Name
Description
boolean
true
if the page is correctly set, false
if the target page is already the selected one.
Name
Description
InvalidPage
If the page number is not a positive number.
setParameters(params)
Sets query parameters.
**Source:**queries/BaseQuery.js, line 484
Inherited From: cdf.queries.BaseQuery#setParameters
params : Object
The query parameters.
Name
Default Value
Summary
params : Object
The query parameters.
setSearchPattern(pattern)
Sets the search pattern for the query.
**Source:**queries/BaseQuery.js, line 514
Inherited From: cdf.queries.BaseQuery#setSearchPattern
pattern : string
The search pattern.
Name
Default Value
Summary
pattern : string
The search pattern.
setSortBy(sortBy)Abstract
Sets the sorting options.
**Source:**queries/BaseQuery.js, line 322
Inherited From: cdf.queries.BaseQuery#setSortBy
sortBy : string
Sorting options.
Name
Default Value
Summary
sortBy : string
Sorting options.
sortBy(sortBy, outsideCallback)Abstract
Sorts the data, specifying a callback that will be called after the sorting takes place.
**Source:**queries/BaseQuery.js, line 334
Inherited From: cdf.queries.BaseQuery#sortBy
sortBy : string
Sorting options.
outsideCallback : function
Post-sort callback.
Name
Default Value
Summary
sortBy : string
Sorting options.
outsideCallback : function
Post-sort callback.
Last updated
Was this helpful?