Base manager class

Description

The base class used for search managers. This class is not designed to be subclassed.

Library path

Properties common to all search managers

Name

Default value

Description

id Required. The unique ID for this control.
settingsThe properties of the search manager. See the methods below to get and set values.

Methods common to all search managers

Name

Description

cancelCancels the search job.
data(results_type)Returns the results model as a SplunkResultsModel object.

Valid values for results_type are: ( events | preview | results | summary ).

The SplunkResultsModel object has the following methods:
  • data: Returns an array of rows containing data.
  • collection: Returns a Backbone collection containing an array of rows of data.
  • hasData: Returns a Boolean that indicates whether the object contains data.

For details about working with the results model, see Search results model.

finalizeFinalizes the search job.
pausePauses the search job.
settings.get( property )Returns the value of property for the current component.
settings.set( propertyvalue )Sets the value of property to the specified value for the current component.
startSearchCreates the search job.
unpauseResumes the search job.

Events common to all search managers

Name

Description

search:cancelledFired when the search is cancelled. Changing the properties of the search starts a new one, which may cancel an old search.
search:doneFired when the search has finished. Note that this event is never fired for a real-time search.
search:errorFired when an error occurs, such as when the user does not provide a search query, the user does not provide a valid name of a saved search, or when a network failure occurs.
search:failedFired when the search job fails.
search:progressFired to indicate search progress.
search:startFired when the search is successfully started.

Example constructor

require([
    "splunkjs/mvc/searchmanager",
    "splunkjs/mvc/simplexml/ready!"
], function(SearchManager) {
        
    var mysearch = new SearchManager({
        id: "search1",
        preview: true,
        cache: true,
        status_buckets: 300,
        search: "index=_internal | head 1000 | stats count by sourcetype"
    });

});