7

null 値を除外する MQL クエリを作成しようとしています。

私が今持っているクエリ ( MQL Query Editorを使用して実行できます):

[
  {
    "/common/topic/image" : [
      {
        "id" : null
      }
    ],
    "article" : [
      {
        "content" : null
      }
    ],
    "name" : "bill gates",
    "type" : "/common/topic"
  }
]

私が得ている結果:

[
  {
    "/common/topic/image" : [
      {
        "id" : "/guid/9202a8c04000641f8000000004fb4c01"
      },
      {
        "id" : "/wikipedia/images/commons_id/4486276"
      }
    ],
    "article" : [
      {
        "content" : null
      },
      {
        "content" : "/guid/9202a8c04000641f800000000903535d"
      }
    ],
    "name" : "Bill Gates",
    "type" : "/common/topic"
  }
]

クエリ時に「記事」配列で「コンテンツ」: null 一致を除外する方法を理解しようとしています。MQL のドキュメントを調べましたが、これを行う明確な方法がわかりませんでした。

4

1 に答える 1

10

コンテンツが割り当てられていない記事を除外するには、コンテンツ ID 属性を展開し、オプションのディレクティブを false に設定する必要があります。

[
  {
    "/common/topic/image" : [
      {
        "id" : null
      }
    ],
    "article" : [
      {
        "content" : {
          "id" : null,
          "optional" : false
        }
      }
    ],
    "name" : "bill gates",
    "type" : "/common/topic"
  }
]

これにより、次の結果が得られます。

[
  {
    "/common/topic/image" : [
      {
        "id" : "/guid/9202a8c04000641f8000000004fb4c01"
      },
      {
        "id" : "/wikipedia/images/commons_id/4486276"
      }
    ],
    "article" : [
      {
        "content" : {
          "id" : "/guid/9202a8c04000641f800000000903535d"
        }
      }
    ],
    "name" : "Bill Gates",
    "type" : "/common/topic"
  }
]

オプションのディレクティブの使用に関する詳細については、こちらのドキュメントを参照してください。

于 2009-03-24T18:39:24.857 に答える