Documentation Center

Migrating to new metadata and language queries

As from Tridion Docs 15, the dynamic metadata fields and dynamic language fields that use the "+" symbol are deprecated in favor of new field notations, so you are urged to convert any such queries, if you have not already done so. This topic explains how.

Procedure

  1. Anywhere in your code where you reference a dynamic metadata field key-value pair with a "+" symbol, convert this into a metadataField field. For example, here's how to convert a (now discontinued) searchByField call:
    Old code
    searchByField(field: "dynamic+KEY+SUBKEY", value: "VALUE")
    New code
    search(
      criteria:{
        metadataField:{
            keys: ["KEY", "SUBKEY"]
            value: "VALUE"
        }
      }
    )

    where KEY and SUBKEY identify the metadata field whose value you're searching, and VALUE is the value.

    Example of old query: searchByField(field:"dynamic+nested+tcmmeta", value:"tcm")

    Example of new query:
    search(
      criteria:{
        metadataField:{
          keys: ["nested", "tcmmeta"]
          value: "tcm"
        }
      }
    )

    Example of old query: searchByField(field:"dynamic+ish.meta", value:"ish")

    Example of new query:
    search(
      criteria:{
        metadataField:{
          keys: ["ish.meta"]
          value: "ish"
        }
      }
    )
  2. Anywhere in your code where you reference a dynamic language field name-language pair with a "+" symbol, combined with a value, convert this into a languageField field. For example, here's how to convert a (now discontinued) searchByField call:
    Old code
    searchByField(field: "FIELDNAME+LANGUAGE", value: "VALUE")
    New code
    search(
      criteria:{
        languageField:{
            key: "FIELDNAME",
            value: "VALUE",
            language: "LANGUAGE"
        }
      }
    )

    where FIELDNAME is the field whose value you're searching, LANGUAGE is the language in which you're searching, and VALUE is the value.