如何过滤Query Builder json返回的结果?

时间:2017-04-17 17:59:29

标签: json cq5 aem

有人可以帮我解决一下如何过滤查询构建器json servlet返回的结果吗?以下是json响应,

{
  "success":true,
  "results":2,
  "total":2,
  "more":false,
  "offset":0,
  "hits":[
  {
     "SourceNodePath":"/content/en/events",
     "Status":"COMPLETED",
     "dateRequested":1492325940000,
     "ContentType":"PAGE",
     "SubmissionId":[
        "016192"
     ],
     "SourceLanguage":"en",
     "TargetLanguages":[
        "fr"
     ],
     "dateCreated":1492191038787,
     "dateReceived":1492191112322,
     "Identifier":1492191038787,
     "Initiator":"user",
     "name":"2",
     "Code":"201"
  },
  {
     "SourceNodePath":"/content/en/toolbar",
     "Status":"COMPLETED",
     "dateRequested":1492325940000,
     "ContentType":"PAGE",
     "SubmissionId":[
        "016190"
     ],
     "SourceLanguage":"en",
     "TargetLanguages":[
        "de"
     ],
     "dateCreated":1492190651609,
     "dateReceived":1492190694082,
     "Identifier":1492190651609,
     "Initiator":"foo",
     "name":"1",
     "Code":"201"
  }
 ]
}

我是AEM开发的新手,有没有办法修改QueryBuilder JSON Servlet,以便显示具有“Initiator”值的结果,例如在这种情况下,“user”? “启动器”获取AEM登录时的用户名值。

1 个答案:

答案 0 :(得分:0)

在您的查询中,您可以将其定义为

property=Initiator
property.value=user

本文概述了所有选项,因此请花点时间阅读它: https://docs.adobe.com/docs/en/aem/6-2/develop/search/querybuilder-api.html

我还假设您知道可以在此网址上构建查询并查看输出与不同参数的差异:/libs/cq/search/content/querydebug.html