Folding fields
Folding fields
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 haveABC
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 have123
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. - Original message
@foldingcollection: “ABC”
@foldingchild: “123”
@foldingparent: “123”
- 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”
- Reply 1
@foldingcollection: “ABC”
@foldingchild: “124”
@foldingparent: “123”
You should typically use the
Folding
component when you may have to deal with multi-level relationships. - Original message
@foldingcollection: “ABC”
@foldingchild: “123”
@foldingparent: “123”
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:
- Be of the String type.
- Have the Displayable in Results option enabled.
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:
- The
field
option sets thefilterField
query parameter. - The
child
option sets theparentField
(notchildField
) query parameter. - The
parent
option sets thechildField
(notparentField
) query parameter. - The
range
option sets the
filterFieldRange
query parameter.
- The
-
Before the May 2018 release of the JavaScript Search Framework (see May 2018 release (v2.4094.8)), the option to use for
child
wasparent-field
, and the option to use for
parent
waschild-field
. Those options are now deprecated.