Class: QueryBuilderView

QueryBuilderView()

A view that provides a UI for users to construct a complex search through the DataONE Solr index

Screenshot

Constructor

new QueryBuilderView()

Since:
  • 2.14.0
Source:

Extends

  • Backbone.View

Members

addRuleButtonID :string

An ID for the element in the template that a user should click to add a new rule. A unique ID will be appended to this ID, and the ID will be added to the template.
Type:
  • string
Since:
  • 2.17.0
Source:

addRuleGroupButtonID :string

An ID for the element in the template that a user should click to add a new rule group. A unique ID will be appended to this ID, and the ID will be added to the template.
Type:
  • string
Since:
  • 2.17.0
Source:

className :string

The HTML class names for this view element
Type:
  • string
Source:

collection :Filters

A Filters collection that stores filters to be edited with this Query Builder, e.g. the definitionFilters in a Collection or Portal model. If a filterGroup is set, then collection doesn't necessarily need to be set, as the Filters collection from within the FilterGroup model will automatically be set on view.
Type:
Source:

excludeFields :Array.<string>

Query fields to exclude in the metadata field selector of each Query Rule. This is a list of field names that exist in the query service index (i.e. Solr), but which should be hidden in the Query Builder
Type:
  • Array.<string>
Source:

excludeInputSelector :string

A JQuery selector for the element in the template that will contain the input allowing a user to switch the exclude attribute from "include" to "exclude" (i.e. to switch between exclude:false and exclude:true in the filterGroup model.)
Type:
  • string
Since:
  • 2.17.0
Source:

filterGroup :FilterGroup

The FilterGroup model that stores the filters, the exclude attribute, and the group operator to be edited with this Query Builder. This does not need to be set; just a Filters collection can be set on the view instead, but then there will be no input to switch between the include & exclude and any & all, since these are the exclude and operator attributes on the filterGroup model.
Type:
Since:
  • 2.17.0
Source:

nestedExcludeFields :Array.<string>

Query fields to exclude in the metadata field selector for any Query Rules that are in nested Query Builders (i.e. in nested Filter Groups). This is a list of field names that exist in the query service index (i.e. Solr), but which should be hidden in nested Query Builders
Type:
  • Array.<string>
Source:

nestedLevelsAllowed :number

The maximum number of levels nested Rule Groups (i.e. nested FilterGroup models) that a user is permitted to *build* in the Query Builder. If a Portal/Collection document is loaded into the Query Builder that has more than the maximum allowable nested levels, those levels will still be displayed. This only prevents the "Add Rule Group" button from being shown.
Type:
  • number
Since:
  • 2.17.0
Source:

operatorInputSelector :string

A JQuery selector for the element in the template that will contain the input allowing a user to switch the operator from "all" to "any" (i.e. to switch between operator:"AND" and exclude:"OR" in the filterGroup model.)
Type:
  • string
Since:
  • 2.17.0
Source:

ruleColorPalette :Array.<string>

An array of hex color codes used to help distinguish between different rules
Type:
  • Array.<string>
Source:

rules :Array.<QueryRuleView>

The list of QueryRuleViews that are contained within this queryBuilder
Type:
Source:

rulesContainerSelector :string

A JQuery selector for the element in the template that will contain the query rules
Type:
  • string
Source:

specialFields :Array.<SpecialField>

Query fields that do not exist in the query service index, but which we would like to show as options in the Query Builder field input.
Type:
Since:
  • 2.15.0
Source:

template :Underscore.template

The primary HTML template for this view
Type:
  • Underscore.template
Source:

type :string

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

Methods

addQueryRule(filterModel)

Appends a new row (Query Rule View) to the end of the Query Builder
Parameters:
Name Type Description
filterModel Filter | FilterGroup The Filter model or FilterGroup model for which to create a rule. If none is provided, then a Filter group model will be created and added to the collection.
Source:

addQueryRuleGroup(filterGroupModel)

Exactly the same as QueryBuilderView#addQueryRule, except that if no model is provided to this function, then a FilterGroup model will be created instead of a Filter model.
Parameters:
Name Type Description
filterGroupModel FilterGroup
Source:

events() → {Object}

events - A function that specifies a set of DOM events that will be bound to methods on your View through Backbone.delegateEvents.
Source:
See:
Returns:
The events hash
Type
Object

initialize(options)

Creates a new QueryBuilderView
Parameters:
Name Type Description
options Object A literal object with options to pass to the view
Source:

render() → {QueryBuilder}

render - Render the view
Source:
Returns:
Returns the view
Type
QueryBuilder

renderExcludeOperatorInputs()

Insert two inputs: one that allows the user to edit the "exclude" attribute in the FilterGroup model by selecting either "include" or "exclude"; and a second that allows the user to edit the "operator" attribute in the FilterGroup model by selecting between "all" and "any".
Since:
  • 2.17.0
Source: