Class: SolrResult

SolrResult()

A single result from the Solr search service

Constructor

new SolrResult()

Source:

Extends

  • Backbone.Model

Members

defaults

Properties:
Name Type Description
defaults object The default attributes for this model This model contains all of the attributes found in the SOLR 'docs' field inside of the SOLR response element
Source:

type :string

The type of this model
Type:
  • string
Source:

Methods

checkAuthority(actionopt) → {boolean|null}

Checks if the currently-logged-in user is authorized to change permissions (or other action if set as parameter) on this doc
Parameters:
Name Type Attributes Description
action string <optional>
The action (read, write, or changePermission) to check if the current user has authorization to perform. By default checks for the highest level of permission.
Source:
Returns:
True if the user is authorized, false if not, or null if the authServiceUrl is not set
Type
boolean | null

createViewURL() → {string}

Creates a URL for viewing more information about this metadata
Source:
Returns:
The URL to view this metadata
Type
string

downloadFromResponse(response) → {Response}

Download data onto the user's computer from the response object
Parameters:
Name Type Description
response Response The response object from the fetch request
Since:
  • 2.32.0
Source:
Returns:
The response object
Type
Response

downloadWithCredentials() → {Promise}

Download this object while sending the user's auth token in the request.
Since:
  • 2.32.0
Source:
Returns:
A promise that resolves to the response object
Type
Promise

fetchDataObjectWithCredentials() → {Promise}

This method will fetch this object while sending the user's auth token in the request. The data can then be downloaded or displayed in the browser
Since:
  • 2.32.0
Source:
Returns:
A promise that resolves when the data is fetched
Type
Promise

findLatestVersion(newestopt, neweropt)

Transgresses the obsolence chain until it finds the newest version that this user is authorized to read
Parameters:
Name Type Attributes Description
newest string <optional>
The id of the newest version to start with. If not supplied, this model's id will be used.
newer string <optional>
The id of a possibly newer version.
Source:

getCitationInfo()

Get the citation information for this object from the Solr index
Source:

getDerivations() → {Array.<string>}

Returns an array of all the IDs of objects that are derivations of this object
Source:
Returns:
An array of derivation IDs
Type
Array.<string>

getFileNameFromResponse(response) → {string}

Get the filename from the response headers or default to the model's title, id, or "download"
Parameters:
Name Type Description
response Response The response object from the fetch request
Since:
  • 2.32.0
Source:
Returns:
The filename to save the file as
Type
string

getFormat() → {string}

Get a plain-english version of the specific format ID (for selected ids)
Source:
Returns:
The specific format of this object
Type
string

getInfo(queryFieldsopt)

Get the information for this object from the Solr index
Parameters:
Name Type Attributes Description
queryFields string | Array.<string> <optional>
Optional. A comma-separated string of fields to retrieve from the Solr index, or an array. If not specified, a default set of fields will be used.
Source:

getInputs() → {Array.<string>}

Source:
Returns:
IDs of all objs that are used by this obj
Type
Array.<string>

getOutputs() → {Array.<string>}

Source:
Returns:
IDs of all objs that are generated by this obj
Type
Array.<string>

getSources() → {Array.<string>}

Returns an array of all the IDs of objects that are sources of this object
Source:
Returns:
An array of source IDs
Type
Array.<string>

getSysMeta()

Get the system metadata for this object
Source:

getType() → {string}

Returns a plain-english version of the general format - either image, program, metadata, PDF, annotation or data
Source:
Returns:
The type of this object, such as "image", "program", "metadata", "PDF", "annotation" or "data"
Type
string

handleDownloadError(e)

Handle an error that occurs when downloading the object
Parameters:
Name Type Description
e Error The error that occurred
Since:
  • 2.32.0
Source:

hasProvTrace() → {boolean}

Returns true if this SolrResult has a provenance trace (i.e. has either sources or derivations)
Source:
Returns:
True if this object has a provenance trace, false otherwise
Type
boolean

hideMetrics() → {boolean}

Uses the app configuration to check if this model's metrics should be hidden in the display
Source:
Returns:
True if the metrics should be hidden, false otherwise
Type
boolean

initialize()

Source:

isDOI(customString) → {boolean}

Checks if the pid or sid or given string is a DOI
Parameters:
Name Type Description
customString string Optional. An identifier string to check instead of the id and seriesId attributes on the model
Source:
Returns:
True if it is a DOI
Type
boolean

isDerivationField(field) → {boolean}

Returns true if this provenance field points to a derivation of this data or metadata object
Parameters:
Name Type Description
field string The provenance field to check
Source:
Returns:
True if this field is a derivation field, false otherwise
Type
boolean

isSourceField(field) → {boolean}

Returns true if this provenance field points to a source of this data or metadata object
Parameters:
Name Type Description
field string The provenance field to check
Source:
Returns:
True if this field is a source field, false otherwise
Type
boolean

parseResourceMapField(json) → {string|Array.<string>}

Parses the resourceMap field from the Solr response JSON.
Parameters:
Name Type Description
json object The JSON object from the Solr response
Source:
Returns:
The resourceMap parsed. If it is a string, it returns the trimmed string. If it is an array, it returns an array of trimmed strings. If it is neither, it returns an empty array.
Type
string | Array.<string>

setURL()

Sets the URL for this object based on the id and seriesId
Source:

toggle()

Toggle the `selected` state of the result
Source: