new Query(query, spaceopt, connectorsopt) → {FooTable.Query}
The query object is used to parse and test the filtering component's queries
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
query |
string | The string value of the query. | ||
space |
string |
<optional> |
"AND" | How the query treats whitespace. |
connectors |
boolean |
<optional> |
true | Whether or not to replace phrase connectors (+.-_) with spaces. |
Returns:
- Type
- FooTable.Query
Extends
Members
(private) _original :string
Holds the previous value of the query and is used internally in the
FooTable.Query#val
method.
Type:
- string
(private) _value :string
Holds the value for the query. Access to this variable is provided through the
FooTable.Query#val
method.
Type:
- string
connectors :boolean
Whether or not to replace phrase connectors (+.-_) with spaces before executing the query.
Type:
- boolean
left :FooTable.Query
The left side of the query if one exists. OR takes precedence over AND.
Type:
Example
query = "Dave AND Mary" - "Dave" is the left side of the query.
query = "Dave AND Mary OR John" - "Dave and Mary" is the left side of the query.
operator :string
The type of operand to apply to the results of the individual parts of the query.
Type:
- string
parts :Array
The parsed parts of the query. This contains the information used to actually perform a match against a string.
Type:
- Array
right :FooTable.Query
The right side of the query if one exists. OR takes precedence over AND.
Type:
Example
query = "Dave AND Mary" - "Mary" is the right side of the query.
query = "Dave AND Mary OR John" - "John" is the right side of the query.
space :string
A string specifying how the query treats whitespace. Can be either "OR" or "AND".
Type:
- string
Methods
(private, static) _left(str, def) → {boolean}
Matches the left side of the query if one exists with the supplied string.
Parameters:
Name | Type | Description |
---|---|---|
str |
string | The string to test. |
def |
boolean | The default value to return based on the operand. |
Returns:
- Type
- boolean
(private, static) _match(str, def) → {boolean}
Matches this queries parts array against the supplied string.
Parameters:
Name | Type | Description |
---|---|---|
str |
string | The string to test. |
def |
boolean | The default value to return based on the operand. |
Returns:
- Type
- boolean
(private, static) _parse()
Parses the private
FooTable.Query#_value
property and populates the object.
(private, static) _part(str) → {Object}
Parses a single part of a query into an object to use during matching.
Parameters:
Name | Type | Description |
---|---|---|
str |
string | The string representation of the part. |
Returns:
- Type
- Object
(private, static) _right(str, def) → {boolean}
Matches the right side of the query if one exists with the supplied string.
Parameters:
Name | Type | Description |
---|---|---|
str |
string | The string to test. |
def |
boolean | The default value to return based on the operand. |
Returns:
- Type
- boolean
(static) match(str) → {boolean}
Tests the supplied string against the query.
Parameters:
Name | Type | Description |
---|---|---|
str |
string | The string to test. |
Returns:
- Type
- boolean
(static) val(valueopt) → {string|undefined}
Gets or sets the value for the query. During set the value is parsed setting all properties as required.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
value |
string |
<optional> |
If supplied the value to set for this query. |
Returns:
- Type
- string | undefined