I'm working on context-aware suggestions in MarkLogic. In the suggestion request I'm sending the query containing filters selected by user. One of the filters - date filter - uses constraint with computed buckets. My request looks like this:
POST http://<marklogic>:<port>/LATEST/suggest?limit=200&partial-q=ord
Content-Type: application/json
Accept: application/json
{
"search": {
"query": {
"queries": [
{
"and-query": [
{
"value-query": {
"json-property": "order_status",
"text": [
"completed"
]
}
},
{
"value-query": {
"json-property": "product_type",
"text": [
"Foo"
]
}
},
{
"range-constraint-query": {
"constraint-name": "order_date",
"value": "7Days"
}
}
]
}
]
},
"options": {
"default-suggestion-source": {
"range": {
"type": "xs:string",
"field": {
"name": "suggestion"
}
}
},
"constraint": [
{
"name": "order_date",
"range": {
"type": "xs:dateTime",
"facet": false,
"json-property": "order_date",
"computed-bucket": [
{
"name": "7Days",
"ge": "-P7D",
"anchor": "start-of-day"
},
{
"name": "30Days",
"ge": "-P30D",
"anchor": "start-of-day"
},
{
"name": "180Days",
"ge": "-P180D",
"anchor": "start-of-day"
}
]
}
}
]
}
}
}
In the response, among expected values ("suggestion" filed contains paths to all field I want to get suggestions from), I also get "order_date:". Even if I add:
"suggestion-source": [
{
"ref": "order_date"
}
]
I still get it in the results. The only difference is that I get no values if partial-q=order_date:
Any tips how can I get rid of this "order_date:" among results?