Class: Searcher

Searcher

Base class for all searchers

new Searcher(options)

Parameters:
Name Type Description
options Object
Properties
Name Type Argument Default Description
onSelect Septima.Search.Searcher~selectCallback <optional>
Function to call when a result is selected by the user.
searchDelay int <optional>
0 Delay in ms before executing the search
matchesPhrase string <optional>
"matcher" Phrase used to display matches.
usesGeoFunctions boolean <optional>
false Does the implementation need the geo functions
iconURI boolean <optional>
Does the implementation need the geo functions
blankBehavior string <optional>
"search" "none"|"search"
Source:
  • searchers/searcher.js, line 13

Methods

addCustomButtonDef(customButtonDef)

Displays an icon next to each result.
Parameters:
Name Type Description
customButtonDef Septima.Search.Searcher.CustomButtonDef
Source:
  • searchers/searcher.js, line 362

createQueryResult() → {Septima.Search.QueryResult}

Create a {Septima.Search.QueryResult}.
Source:
  • searchers/searcher.js, line 180
Returns:
Type
Septima.Search.QueryResult

fetchData(query, caller)

This method is called is called by the controller when the driver should fetch data.
This method MUST be implemented by all seachers
A call to this method MUST result in either a call to Septima.Search.Controller.fetchSuccess(Septima.Search.QueryResult) or caller.fetchError()
Parameters:
Name Type Description
query Septima.Search.Query
caller Septima.Search.Controller
Source:
  • searchers/searcher.js, line 226

getCentroid(geoJsonObject) → {GeoJsonObject}

Find the centroid
Parameters:
Name Type Description
geoJsonObject geoJsonObject
Source:
  • searchers/searcher.js, line 212
Returns:
Type
GeoJsonObject

getPointOnSurface(geoJsonObject) → {GeoJsonObject}

Find a point guaranteed to lie on the surface
Parameters:
Name Type Description
geoJsonObject geoJsonObject
Source:
  • searchers/searcher.js, line 200
Returns:
Type
GeoJsonObject

onSelect(result)

This method is called by the controller when a result is selected.
This method MAY be implemented by searchers.
Implementations MUST call this._onSelectCallback(result)
Parameters:
Name Type Description
result Septima.Search.Searcher.Result
Source:
  • searchers/searcher.js, line 155

registerTarget(target)

Register a target.
Parameters:
Name Type Description
target string
Source:
  • searchers/searcher.js, line 165

translateWktToGeoJsonObject(wkt) → {GeoJsonObject}

Convert a wkt string to a geojson object
Parameters:
Name Type Description
wkt string
Source:
  • searchers/searcher.js, line 189
Returns:
Type
GeoJsonObject

Type Definitions

CustomButtonDef

Definition of a button, icon, or link which is presented together with search results
Type:
  • Object
Properties:
Name Type Argument Description
buttonText string Text or tooltip
buttonImage string URL of image (20*20)
callBack function Called when icon is clicked (callBack(result))
target string <optional>
Name of target
Source:
  • searchers/searcher.js, line 349

Result

A search result item created by a searcher
Type:
  • Object
Properties:
Name Type Description
title string The title as displayed in the search result
description string The description as displayed in the search result
geometry object geojson
searcher Septima.Search.Searcher
data object Searcher specific data - See each searcher for details
Source:
  • searchers/searcher.js, line 119

selectCallback(result)

A function which is called when a result is selected.
Parameters:
Name Type Description
result Septima.Search.Searcher.Result
Source:
  • searchers/searcher.js, line 68