Skip to content

Architectural overview

James McKinney edited this page Apr 13, 2013 · 30 revisions

AJAX Solr loosely follows the Model-view-controller pattern. The ParameterStore is the model, storing the Solr parameters and, thus, the state of the application. The Manager is the controller; it talks to the ParameterStore, sends requests to Solr, and delegates the response to the widgets for rendering. The widgets are the views, each rendering a part of the interface.

Table of Contents

Inheritance

You can easily take an existing class and extend its functionality by writing a new class that inherits from the existing class. To inherit from any class in the AjaxSolr namespace, write:

AjaxSolr.ChildClass = AjaxSolr.ParentClass.extend({
  /* key/value pairs */
});

If you are not adding a significant amount of functionality to a parent class, instead of creating a new class, you may choose to override or add to the parent class’s properties and methods during initialization:

Manager.addWidget(new AjaxSolr.PagerWidget({
  innerWindow: 1,
  renderHeader: function (perPage, offset, total) {
    /* override a method defined on the parent widget */
  },
  beforeRequest: function () {
    /* implement a method not defined on the parent widget */
  }
}));

File hierarchy

  • core/ includes all framework-agnostic managers, parameter stores, and abstract widgets.
  • managers/ includes all framework-specific managers.
  • widgets/ includes all framework-specific widgets.

Each JavaScript “class”, e.g. AbstractManager, is defined it its own file.

Every AJAX Solr class, method, and property is implemented within the AjaxSolr namespace.

AJAX Solr defines core helpers in Core.js, like inArray, flatten, grep, and compact.