-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
The Not Equals operator either does not function as intended, or is documented incorrectly.
https://github.com/yext/search-core/blob/master/docs/search-core.matcher.md
Using the !$eq operator in any filter results in the following error:
"code": 9413,
"type": "FATAL ERROR",
"message": "Invalid parameter: The following operator in the filters parameter is invalid: key !$eq, value: \"test\""`,
"name": ANSWERS_PARAMETER_INVALID
The Matcher enum has a remark that this value should be compatible with all field types.
/**
* A not equals comparison
*
* @remarks
* Compatible with all field types.
*/
NotEquals = "!$eq",
Some example queries that do not work (throw the above error):
filters: {
"c_something": {"!$eq": "test"}
}
filters: {
"c_something": {"!$eq": 1}
}
filters: {
"c_something": {"!$eq": true}
}
Some example queries that do work (do not throw the above error):
filters: {
"c_something": {"$eq": "test"}
}
filters: {
"c_something": {"$eq": 1}
}
filters: {
"c_something": {"$eq": true}
}
an example using 'seach-headless-react':
Fails:
const test = {
selected: true,
filter: {
kind: "fieldValue",
fieldId: 'c_something',
value: 'test',
matcher: Matcher.NotEquals,
}
}
searchActions.setStaticFilters([test]);
Works:
const test = {
selected: true,
filter: {
kind: "fieldValue",
fieldId: 'c_something',
value: 'test',
matcher: Matcher.Equals,
}
}
searchActions.setStaticFilters([test]);
I also attempted a few other matchers to see if maybe it was incorrect in the TS api, but they also do not seem to work: $neq, $!eq
Metadata
Metadata
Assignees
Labels
No labels