I need to be able to filter by a wildcard or if the field is blank. Is this possible?
$('.element').swiftypeSearch({
...
filters: {
page_type: ['*', 'resource', ''],
}
...
});
I need to be able to filter by a wildcard or if the field is blank. Is this possible?
$('.element').swiftypeSearch({
...
filters: {
page_type: ['*', 'resource', ''],
}
...
});
Great question! It’s not possible to filter via a wildcard or null value, but you can use the bang operator to request results that do not match to the stated value or array. For example, if you have 2 page_type
values (resource & category) and want to return only content with no set page_type value
, you’d declare the filter option like so:
filters: {
"YOUR_DOC_TYPE": {
"page_type": ["!resource", "!category"]
}
}
Any plans on adding support for wildcards or NULL values? I’m especially interested in NULL value support. The engine I am setting up could benefit from hiding search results that don’t have values defined for particular field(s). For example, if a page does not have a custom field defined in its meta tags, and that field does not exist in the JSON object.
Thanks!
Nothing on the roadmap just yet to filter out document records that are absent a specific field or contain no values for that field. I’ll log the feedback to JIRA though.
Much appreciated!
Do you publish the current development roadmap anywhere?
Thank you.
I would also very much appreciate the null value filtering. Any progress on this? Thanks!
We could really use this functionality as well.