Content Property Index Key Configuration

On This Page

    A Content Property Index Key Configuration defines which values from your JSON content property object should be indexed by Confluence and made available to the CQL search syntax.

    Each content property key will define one or more extractions which will allow for multiple values from your JSON content property to be used in CQL. Each extraction defines a single field that will be queryable using the relevant CQL syntax as seen below.

    In the wordcount example, we store details of the page that describe the word and character counts.

    After storing this JSON object as a content property:

    1 2 3 4 5 6 { "wordCount": 5 "characterCount": 22 }

    We then define a series of extractions to allow access to the 'wordCount' and 'characterCount' properties.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    
     {
       "propertyKey": "wordcount_addon",
       "extractions": [
         { "objectName": "wordCount", "type": "number" },
         { "objectName": "characterCount", "type": "number" }
       ]
     }
     

    You can access this property in your CQL queries as:

    1
    2
    3
    
     space = currentSpace() and content.property[wordcount_addon].wordCount <= 1000
     

    This is constructed using the following:

    1
    2
    3
    
     content.property[propertyKey].objectName
     

    You can simplify the CQL syntax even further by defining an alias for the extraction:

    1
    2
    3
    4
    5
    6
    7
    8
    
     {
       "propertyKey": "wordcount_addon",
       "extractions": [
         { "objectName": "wordCount", "type": "number", alias: "wordcount" }
       ]
     }
     

    This allows you to refer to your data using the alias:

    1
    2
    3
    
     space = currentSpace() and wordcount <= 1000
     

    Important: Both the propertyKey and the alias must be globally unique. Prefixing it with the name of your add-on is the best way to ensure this.

    Example

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    {
      "propertyKey": "myFirstAddon_attachment",
      "extractions": [
        {
          "objectName": "attachment.size",
          "type": "number"
        },
        {
          "objectName": "attachment.type",
          "type": "string",
          "alias": "myFirstAddon_contentType",
          "uiSupport": {
            "defaultOperator": "~",
            "name": {
              "value": "Content Type",
              "i18n": "attachment.type.name"
            },
            "tooltip": {
              "value": "Content Type Tooltip",
              "i18n": "attachment.type.tooltip"
            },
            "dataUri": "/data/content-types",
            "valueType": "string"
          }
        },
        {
          "objectName": "attachment.updated",
          "type": "date"
        }
      ]
    }
    

    Properties

    extractions
    Type
    [Content Property Index Extraction Configuration, ...]
    Required
    Yes
    Description

    The list with references to values of JSON objects which will be indexed and the types of referenced values.


    propertyKey
    Type
    string
    Max length
    100
    Required
    Yes
    Description

    The key of the property from which the data is indexed. Only alphanumeric and underscore (_) characters are allowed.

    Important: Must be globally unique. Prefixing it with the name of your add-on is the best way to ensure this.


    Rate this page: