Class: FilterGroup

FilterGroup()

A group of multiple Filters, and optionally nested Filter Groups, which may be combined to create a complex query. A FilterGroup may be a Collection FilterGroupType or a Portal UIFilterGroupType.

Constructor

new FilterGroup()

Source:

Extends

  • Backbone.Model

Members

type :string

The name of this Model
Type:
  • string
Source:

Methods

defaults()

Default attributes for FilterGroup models
Properties:
Name Type Description
label string For UIFilterGroupType filter groups, a human-readable short label for this Filter Group
description string For UIFilterGroupType filter groups, a description of the Filter Group's function
icon string For UIFilterGroupType filter groups, a term that identifies a single icon in a supported icon library.
filters Filters A collection of Filter models that represent a full or partial query
objectDOM XMLElement FilterGroup XML
operator string The operator to use between filters (including filter groups) set on this model. Must be set to "AND" or "OR".
exclude boolean If true, search index docs matching the filters within this group will be excluded from the search results
isUIFilterType boolean Set to true if this group is UIFilterGroupType (aka custom Portal search filter). Otherwise, it's assumed that this model is FilterGroupType (e.g. a Collection FilterGroupType)
nodeName string the XML node name to use when serializing this model. For example, may be "filterGroup" or "definition".
isInvisible boolean If true, this filter will be added to the query but will act in the "background", like a default filter. It will not appear in the Query Builder or other UIs. If this is invisible, then the "isInvisible" property on sub-filters will be ignored.
mustMatchIds boolean If the search results must always match one of the ids in the id filters, then the id filters will be added to the query with an AND operator.
Source:

getQuery() → {string}

Builds the query string to send to the query engine. Iterates over each filter in the filter group and adds to the query string.
Source:
Returns:
The query string to send to Solr
Type
string

initialize()

This function is executed whenever a new FilterGroup model is created. Model attributes are set either by parsing attributes.objectDOM or ny extracting the properties from attributes (e.g. attributes.nodeName, attributes.operator, etc)
Source:

isEmpty() → {boolean}

isEmpty - Checks whether this Filter Group has any filter models that are not empty.
Source:
Returns:
returns true if the Filter Group has Filter models that are not empty
Type
boolean

parse(xml, catalogSearch) → {JSON}

Overrides the default Backbone.Model.parse() function to parse the filterGroup XML snippet
Parameters:
Name Type Description
xml Element The XML Element that contains all the FilterGroup elements
catalogSearch boolean [false] - Set to true to append a catalog search phrase to the search query created from Filters that limits the results to un-obsoleted metadata.
Source:
Returns:
The result of the parsed XML, in JSON. To be set directly on the model.
Type
JSON

parseTextNode(parentNode, nodeName, isMultiple) → {string|Array}

Gets the text content of the XML node matching the given node name
Parameters:
Name Type Description
parentNode Element The parent node to select from
nodeName string The name of the XML node to parse
isMultiple boolean If true, parses the nodes into an array
Source:
Returns:
- Returns a string or array of strings of the text content
Type
string | Array

updateDOM(optionsopt) → {XMLElement}

Updates the XML DOM with the new values from the model
Parameters:
Name Type Attributes Description
options object <optional>
A literal object with options for this serialization
Source:
Returns:
An updated filterGroup XML element
Type
XMLElement

validate(attrsopt, optionsopt) → {Object}

Overrides the default Backbone.Model.validate.function() to check if this FilterGroup model has all the required values.
Parameters:
Name Type Attributes Description
attrs Object <optional>
A literal object of model attributes to validate.
options Object <optional>
A literal object of options for this validation process
Source:
Returns:
If there are errors, an object comprising error messages. If no errors, returns nothing.
Type
Object