Class: SearchResultsView

SearchResultsView()

A view of search results.

Constructor

new SearchResultsView()

Since:
  • 2.22.0
Source:

Extends

  • Backbone.View

Members

className :string

The HTML classes to use for this view's element
Type:
  • string
Source:

events :Object

The events this view will listen to and the associated function to call.
Type:
  • Object
Source:

metricsModel :MetricsModel

The metrics model that will be passed to the search result view
Type:
  • MetricsModel
Since:
  • 2.25.0
Source:

noResultsTemplate :string

The HTML to display when no search results are found.
Type:
  • string
Since:
  • 2.22.0
Source:

searchResults :SolrResults

The SolrResults collection that fetches and parses the searches.
Type:
Source:

tagName :string

The HTML tag to use for this view's element
Type:
  • string
Source:

type :string

The type of View this is
Type:
  • string
Source:

Methods

addResultCollection()

Renders all SolrResults from the SearchResultsView#searchResults collection.
Source:

addResultModel(searchResult)

Renders the given SolrResult model inside this view.
Parameters:
Name Type Description
searchResult SolrResult
Source:

addResultView(view)

Adds a Search Result View to the page
Parameters:
Name Type Description
view SearchResultView
Source:

createSearchResultView()

Creates a Search Result View
Source:

empty()

Removes all child elements from this view.
Source:

loading()

Renders a skeleton of this view that communicates to the user that it is loading.
Source:

removeListeners()

Removes listeners set by the SearchResultsView#startListening method. This is important to prevent zombie listeners from being created.
Source:

render()

Render the view.
Source:

setSearchResults() → {SolrResults}

Creates and sets the SearchResultsView#searchResults property.
Source:
Returns:
Type
SolrResults

setUpMetrics() → {MetricsModel}

Creates a new MetricsModel if the app is configured to display metrics. Sets the metrics model on this view. The metrics model is used to display views, citations, and downloads for each search result.
Since:
  • 2.25.0
Source:
Returns:
Type
MetricsModel

showError(searchResults, response)

When there is an error fetching the search results, show an alert message to the user.
Parameters:
Name Type Description
searchResults SolrResults The collection of search results
response Object The response from the server
Source:

showNoResults()

Shows a message when no search results have been found.
Source:

startListening()

Sets listeners on the SearchResultsView#searchResults to change what is displayed in this view.
Source:

updateMetrics() → {MetricsModel}

Updates the metrics model with the PIDs of the search results and fetches the metrics.
Since:
  • 2.25.0
Source:
Returns:
Type
MetricsModel