Class: Search

Search()

Search filters can be either plain text or a filter object with the following options: filterLabel - text that will be displayed in the filter element in the UI label - text that will be displayed in the autocomplete list value - the value that will be included in the query description - a longer text description of the filter value Example: {filterLabel: "Creator", label: "Jared Kibele (16)", value: "Kibele", description: "Search for data creators"}

Constructor

Source:

Extends

  • Backbone.Model

Methods

addFilters(filters)

Parameters:
Name Type Description
filters Filters | Array.<Filter> The collection of filters to add to this model OR an array of Filter models
Source:

defaults()

Properties:
Name Type Description
filters Filters The collection of filters used to build a query, an instance of Filters
Source:

getFacetFields(fields) → {Array.<string>}

Returns an array of facet field names based on the given fields or the default facet fields and the available filters in this search model
Parameters:
Name Type Description
fields Array.<string> An array or comma-separated list of field names to get the facet field names for. If not given, the default facet fields will be used.
Since:
  • 2.36.0
Source:
Returns:
An array of facet field names
Type
Array.<string>

getFacetQueryForQueryService(fields) → {object}

Returns an object with the facet parameters to send to the Query Service
Parameters:
Name Type Description
fields Array.<string> | string An array or comma-separated list of field names to get the facet field names for. If not given, the default facet fields will be used.
Since:
  • 2.36.0
Source:
Returns:
An object with the facet parameters
Type
object

getQuery(filter, options)

Builds the query string to send to the query engine. Goes over each filter specified in this model and adds to the query string. Some filters have special rules on how to format the query, which are built first, then the remaining filters are tacked on to the query string as a basic name:value pair. These "other filters" are specified in the otherFilters variable.
Parameters:
Name Type Description
filter string A single filter to get a query fragment for
options object Additional options for this function
Properties:
Name Type Description
options.forPOST boolean If true, the query will not be url-encoded, for POST requests
Source: