Folding fields

This is for:

Developer
In this article

The FoldingForThread/Folding components rely on three distinct fields in your index. By default, those fields are:

  • @foldingcollection

    Identifies the folding group each item belongs to (for example, all items belonging to the ABC folding group should have ABC as their @foldingcollection field value).

  • @foldingchild

    Uniquely identifies each item.

  • @foldingparent

    Identifies the parent of each item (for example, all items whose parent has 123 as its @foldingchild value should have 123 as their @foldingparent value).

    Any item whose @foldingchild and @foldingparent field values are identical is considered to have no parent.

Assuming you’re using the default folding fields, parent-child relationships could be represented as such in your index:

  • Sample one-level parent-child relationship:
    • Original message @foldingcollection: “ABC” @foldingchild: “123” @foldingparent: “123”
      • Reply 1 @foldingcollection: “ABC” @foldingchild: “124” @foldingparent: “123”
      • Reply 2 @foldingcollection: “ABC” @foldingchild: “125” @foldingparent: “123”

    You should typically use the FoldingForThread component when dealing only with one-level relationships.

  • Sample multi-level parent-child relationship:
    • Original message @foldingcollection: “ABC” @foldingchild: “123” @foldingparent: “123”
      • Reply 1 @foldingcollection: “ABC” @foldingchild: “124” @foldingparent: “123”
        • Attachment 1 @foldingcollection: “ABC” @foldingchild: “127” @foldingparent: “124”
      • Reply 2 @foldingcollection: “ABC” @foldingchild: “125” @foldingparent: “123”

    You should typically use the Folding component when you may have to deal with multi-level relationships.

If necessary, you can specify custom folding fields to use instead of the default ones with the following FoldingForThread/Folding configuration options:

  • field to override @foldingcollection
  • child to override @foldingchild
  • parent to override @foldingparent

If you specify custom folding fields, remember that in the index, each folding field must:

Moreover, values in the child and parent fields may only contain up to 60 alphanumeric characters (for example, assuming you’re using the default folding fields, 123abc is a valid @foldingchild/@foldingparent value, whereas 123_abc is not).

  • If you’re familiar with the Coveo Search API, it’s worth mentioning that:

  • Before the May 2018 release of the JavaScript Search Framework (see May 2018 release (v2.4094.8)), the option to use for child was parent-field, and the option to use for parent was child-field. Those options are now deprecated.