Tutorial: Send a Solr request without updating widgets

jpmckinney edited this page Apr 14, 2013 · 2 revisions

The following information was contributed by Daniel Lo Nigro.

Sometimes, you want to send a request to Solr that uses some of the parameters in the ParameterStore, without causing all the widgets to update with the response. This is fairly easily done with a few lines of code. The next examples assume you are using the jQuery Manager or equivalent.

Note: If the following code is not inside a widget, replace this.manager with a proper reference to the manager.

Modify a copy of the main parameter store

// Create a new parameter store.
var store = new AjaxSolr.ParameterStore();

// Copy the main parameter store.
store.parseString(this.manager.store.string());

// Make any changes you want to the new parameter store.

this.manager.executeRequest('select', store.string(), function (data) {
    // Process the Solr response.
});

Copy only some parameters from the main parameter store

// Create a new parameter store.
var store = new AjaxSolr.ParameterStore();

// Copy all fq parameters from the main parameter store.
store.addByValue('fq', self.manager.store.values('fq'));

// Make any changes you want to the new parameter store.

this.manager.executeRequest('select', store.string(), function (data) {
    // Process the Solr response.
});
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.