1

我正在处理 MarkLogic 中的上下文感知建议。在建议请求中,我发送包含用户选择的过滤器的查询。其中一个过滤器 - 日期过滤器 - 使用计算桶的约束。我的请求如下所示:

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"
              }
            ]
          }
        }
      ]
    }
  }
}

在响应中,在预期值(“建议”字段包含我想从中获取建议的所有字段的路径)中,我还得到“订单日期:”。即使我添加:

      "suggestion-source": [
        {
          "ref": "order_date"
        }
     ]

我仍然在结果中得到它。唯一的区别是如果 partial-q=order_date 我没有得到任何值:

任何提示如何在结果中摆脱这个“order_date:”?

4

0 回答 0