Class: MapSearchConnector

MapSearchConnector()

A model that updates the counts on a Geohash layer in a Map model when the search results from a search model are reset.

Constructor

new MapSearchConnector()

Source:

Extends

  • Backbone.Model

Members

type :string

The type of Backbone.Model this is.
Type:
  • string
Since:
  • 2.25.0
Default Value:
  • "MapSearchConnector"
Source:

Methods

connect()

Connect the Map to the Search. When a new search is performed, the Search will set the new facet counts on the GeoHash layer in the Map. When the view extent on the map has changed, the geohash facet on the search will be updated to reflect the new height/altitude of the view. This will trigger a new search, which will update the counts on the GeoHash layer in the Map. When connected, the Geohash layer will also be hidden during search requests, and while the user is panning/zooming the map.
Source:

createGeohash() → {CesiumGeohash}

Create a new Geohash layer and add it to the Layers collection.
Source:
Fires:
  • Layers#event:add
Returns:
The new Geohash layer or null if there is no Layers collection set on this model.
Type
CesiumGeohash

createLayerGroups() → {Array.<MapAssets>}

Create a new array of MapAssets collection and set it on the Map model.
Source:
Returns:
The new array of MapAssets collection.
Type
Array.<MapAssets>

defaults()

Properties:
Name Type Description
searchResults SolrResults
map Map
onMoveEnd function A function to call when the map is finished moving. This function will be called with the connector as 'this'.
Source:

disconnect()

Disconnect the Map from the Search. Stops listening to the Search results collection.
Source:

facetCountsToGeohashAttrs(counts) → {Array}

Given the counts results in the format returned by the SolrResults model, return an array of objects with a geohash and a count property, formatted for the CesiumGeohash layer.
Parameters:
Name Type Description
counts Array The facet counts from the SolrResults model. Given as an array of alternating keys and values.
Source:
Returns:
An array of objects with a geohash and a count property.
Type
Array

findAndSetGeohashLayer(addopt) → {CesiumGeohash}

Find the Geohash layer in the Map model's layers collection and optionally create one if it doesn't exist. This will also create and set a map and a layers collection from that map if they don't exist.
Parameters:
Name Type Attributes Default Description
add boolean <optional>
true If true, create a new Geohash layer if one doesn't exist.
Source:
Fires:
  • Layers#event:add
Returns:
The Geohash layer in the Map model's layers collection or null if there is no Layers collection set on this model and `add` is false.
Type
CesiumGeohash

findGeohash() → {CesiumGeohash}

Find the first Geohash layer in the Map model's layers collection.
Source:
Returns:
The first Geohash layer in the Map model's layers collection or null if there is no Layers collection set on this model or no Geohash layer in the collection.
Type
CesiumGeohash

findLayerGroups() → {Array.<MapAssets>}

Find the array of MapAssets collection from the Map model.
Source:
Returns:
An array of MapAssets collection from the Map model. Return null if no map or layers are found.
Type
Array.<MapAssets>

getGeohashCounts() → {Array}

Look in the Search results for the facet counts for the Geohash layer.
Source:
Returns:
An array of objects with a geohash and a count property or null if there are no Search results or no facet counts.
Type
Array

hideGeoHashLayer()

Make the geoHashLayer invisible temporarily. This will override the visible property on the layer until the showGeoHashLayer method is called.
Source:
Fires:
  • CesiumGeohash#change:visible

initialize(attrs, optionsopt, addGeohashLayeropt)

Initialize the model.
Parameters:
Name Type Attributes Default Description
attrs Object The attributes for this model.
attributes.searchResults SolrResults | Object <optional>
The SolrResults model to use for this connector or a JSON object with options to create a new SolrResults model. If not provided, a new SolrResults model will be created.
attributes.map Map | Object <optional>
The Map model to use for this connector or a JSON object with options to create a new Map model. If not provided, a new Map model will be created.
options Object <optional>
The options for this model.
addGeohashLayer boolean <optional>
true If true, a Geohash layer will be added to the Map model if there is not already a Geohash layer in the Map model's Layers collection. If false, no Geohash layer will be added. A geohash layer is required for this connector to work.
Source:

onMoveEnd()

Functions to perform when the map has finished moving. This is separated into its own method so that external models can manipulate the behavior of this function. See MapSearchFiltersConnector#onMoveEnd
Source:

selectGeohash(searchResult)

Highlight the geohashes for the given search result on the map, or remove highlighting if the search result is not selected.
Parameters:
Name Type Description
searchResult SolrResult The search result to highlight.
Source:

showGeoHashLayer()

Make the geoHashLayer visible again after hiding it with the hideGeoHashLayer method.
Source:
Fires:
  • CesiumGeohash#change:visible

updateFacet()

Update the facet on the Search results to match the current Geohash level.
Source:
Fires:
  • SolrResults#change:facet

updateGeohashCounts()

Update the Geohash layer in the Map model with the new facet counts from the Search results.
Source:
Fires:
  • CesiumGeohash#change:counts
  • CesiumGeohash#change:totalCount