Class: Controller

Controller

new Controller(searcherRegs, view, options)

The controller binds a view to one or more searchers.
Parameters:
Name Type Argument Description
searcherRegs Septima.Search.Controller.SearcherReg[] An array of Septima.Search.Controller.SearcherReg
view Septima.Search.View An object which implements Septima.Search.View
options Object <optional>
Properties
Name Type Argument Default Description
onError Septima.Search.Controller~errorCallback <optional>
blankBehavior string <optional>
"none" "none"|"search" Determines whether the controller issues an empty querystring to its searchers
Source:
  • controller.js, line 21
Example
 
var controller = new Septima.Search.Controller(
  searcherRegs, // Previously created array of searcherRegs
  view,      // Previously created view
  {onError : function(searcher, errorThrown) { alert('Error: '+ searcher.getId() + ': '+ errorThrown); },
   blankBehavior: "search"
  }
 );
controller.go();
controller.addSearcher(searcherReg); // Additional searchers may be added to the controller after go();

Methods

addSearcher(searcherReg)

Add a searcher
Parameters:
Name Type Description
searcherReg Septima.Search.Controller.SearcherReg
Source:
  • controller.js, line 64

go()

Activate View and searchers
Source:
  • controller.js, line 49

Type Definitions

SearcherReg

A searcher registration.
Type:
  • Object
Properties:
Name Type Description
title string The title of the searcher as presented in the view
searcher Septima.Search.Searcher An implementation of Septima.Search.Searcher
Source:
  • controller.js, line 53

errorCallback(searcher, errorThrown)

A function which is called when an error is thrown in a searcher.
Parameters:
Name Type Description
searcher Septima.Search.Searcher The searcher in which the error was reported
errorThrown string
Source:
  • controller.js, line 73