Thanks, @Brian_McGue. But the example you are referring to is producing a request with facets
field, in stead of filters
as described in range filter and it doesn't seem to have any affect on returned result.
What Im trying to say is that I don't want to create prepopulated facet with dates, but provide the user an date input field where he can freely pick an date, and then this date is used to filter search results.
Request payload sent to App Search:
"facets": {
"published_timestamp": {
"type": "range",
"ranges": [
{
"from": "2020-12-17T00:00:00.000Z",
"to": "2020-12-17T23:59:59.000Z"
}
]
}
},
SearchProvider config:
const config = {
searchQuery: {
facets: {
published_timestamp: {
type: "range",
ranges: [
{
from: new Date(selectedDate).toISOString(),
to: add(new Date(selectedDate), {hours: 23, minutes: 59, seconds: 59}).toISOString(),
}
]
},
},
...buildSearchOptionsFromConfig()
},
Manually invoking Search API with filters
field included in request does what Im trying to achieve:
{
"query": "Product A",
"filters": {
"published_timestamp": {
"from": "2020-12-15T00:00:00.000Z",
"to": "2020-12-15T23:59:59.000Z"
}
},
"result_fields": {
...
},
"search_fields": {
...
},
"page": {
...
}
}