Extends
Members
type :string
The name of this Model
Type:
- string
- Overrides:
- Source:
Methods
defaults() → {object}
Default attributes for this model
Properties:
Name | Type | Description |
---|---|---|
objectDOM |
Element | The XML DOM for this filter |
nodeName |
string | The XML node name for this filter's XML DOM |
fields |
Array.<string> | The search index fields to search |
values |
Array.<string> | The values to search for in the given search fields |
operator |
string | The operator to use between values set on this model. "AND" or "OR" |
queryGroup |
string | The name of the group this Filter is a part of, which is primarily used when creating a query string from multiple Filter models. Filters in the same group will be wrapped in paranthesis in the query. |
exclude |
boolean | If true, search index docs matching this filter will be excluded from the search results |
matchSubstring |
boolean | If true, the search values will be wrapped in wildcard characters to match substrings |
label |
string | A human-readable short label for this Filter |
placeholder |
string | A short example or description of this Filter |
icon |
string | A term that identifies a single icon in a supported icon library |
description |
string | A longer description of this Filter's function |
isInvisible |
boolean | If true, this filter will be added to the query but will act in the "background", like a default filter |
inFilterGroup |
boolean | If true, this filter belongs to a FilterGroup model |
- Overrides:
- Source:
Returns:
- Type
- object
escapeSpecialChar(term) → {string}
Escapes Solr query reserved characters so that search terms can include
those characters without throwing an error.
Parameters:
Name | Type | Description |
---|---|---|
term |
string | The search term or phrase to escape |
- Inherited From:
- Source:
Returns:
- The search term or phrase, after special characters are escaped
- Type
- string
getQuery() → {string}
Builds a query string that represents this filter.
- Inherited From:
- Source:
Returns:
The query string to send to Solr
- Type
- string
getValueQuerySubstring(valuesopt) → {string}
Constructs a query substring for each of the values set on this model
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
values |
Array.<string> |
<optional> |
The values to use in this query substring. If not provided, the values set on the model are used. |
- Inherited From:
- Source:
Returns:
The query substring
- Type
- string
Example
values: ["walker", "jones"]
Returns: "(walker%20OR%20jones)"
hasChangedValues() → {boolean}
Checks if this Filter has values different than the default values.
- Inherited From:
- Source:
Returns:
- Returns true if this Filter has values set on it, otherwise will return false
- Type
- boolean
initialize()
Creates a new Filter model
- Inherited From:
- Source:
isDateQuery(value) → {boolean}
Returns true if the given value or value set on this filter is a date range query
Parameters:
Name | Type | Description |
---|---|---|
value |
string | The string to test |
- Inherited From:
- Source:
Returns:
- Type
- boolean
isEmpty() → {boolean}
isEmpty - Checks whether this Filter has any values or fields set
- Inherited From:
- Source:
Returns:
returns true if the Filter's values and fields are empty
- Type
- boolean
parse(xml) → {JSON}
Parses the booleanFilter XML node into JSON
Parameters:
Name | Type | Description |
---|---|---|
xml |
Element | The XML Element that contains all the BooleanFilter elements |
- Overrides:
- Source:
Returns:
- The JSON object literal to be set on the model
- Type
- JSON
parseFilterOptions(filterOptionsNode) → {Object}
Parses the filterOptions XML node into a literal object
Parameters:
Name | Type | Description |
---|---|---|
filterOptionsNode |
Element | The filterOptions XML element to parse |
- Inherited From:
- Source:
Returns:
- The parsed filter options, in literal object form
- Type
- Object
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 |
- Inherited From:
- Source:
Returns:
- Returns a string or array of strings of the text content
- Type
- string | Array
resetValue()
Resets the values attribute on this filter
- Inherited From:
- Source:
updateDOM(optionsopt) → {Element}
Updates 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 |
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
options.forCollection |
boolean |
<optional> |
If true, will create an XML DOM for Collection definitions, not FilterGroups |
- Overrides:
- Source:
Returns:
A new XML element with the updated values
- Type
- Element
updateFilterOptionsDOM(filterOptionsNodeopt) → {Element}
Serializes the filter options into an XML DOM and returns it
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
filterOptionsNode |
Element |
<optional> |
The XML filterOptions node to update |
- Inherited From:
- Source:
Returns:
- The updated DOM
- Type
- Element
validate() → {object}
Checks if the values set on this model are valid.
Some of the attributes are changed during this process if they are found to be invalid,
since there aren't any easy ways for users to fix these issues themselves in the UI.
- Inherited From:
- Source:
Returns:
- Returns a literal object with the invalid attributes and their corresponding error message
- Type
- object