--- title: Why are some child items not folded? slug: '333' canonical_url: https://docs.coveo.com/en/333/ collection: javascript-search-framework source_format: adoc --- # Why are some child items not folded? > **Note** > > This page assumes you have followed the appropriate steps to implement result folding on your page (see [Folding results](https://docs.coveo.com/en/428/)). One important thing to remember about result folding is that the index won't necessarily fold all of the child items that belong to a parent-child relationship. Only child items that are already present in the current result set will be folded. In other words, the `Folding` and `FoldingForThread` components won't automatically expand the query to retrieve all child items. The `range` value you specify in the `Folding` component represents the maximum number of child items the index tries to fold per parent-child relationship. > **Important** > > A parent-child relationship must always have a parent, regardless of whether this parent is part of the current query result set or not. When a `Folding` component is present in a search interface, the index proceeds as follows to fold query results: . For each parent-child relationship in the current query result set: .. Find the parent. .. While the number of folded child items is less than the `range` value ... Try to find an additional child item, first in the current result set, then in the rest of the indexed items. ... If a child item is found, fold it. **Example** Suppose you enable result folding in your search page and set the `range` value to `6` (see [Enabling result folding](https://docs.coveo.com/en/428#enable-result-folding)). A user sends a query that returns a set of 25 results. Five of those results are email results that belong to the same parent-child relationship (an email conversation). Let's assume that the parent item is in the query result set (in this case, the parent item is probably the oldest email result). This means that the remaining four results that belong to the email conversation are child items (email replies) in this email conversation. The index folds those four results under the parent item. Since the `range` value is `6`, the index can still fold two additional child items. Suppose the original email conversation includes four additional replies. The index folds the first two additional child items it finds (the two most relevant replies that aren't in the current result set). However, the index doesn't fold the remaining two child items, since the `range` value doesn't allow it to fold any more child items. In conclusion, the index folds up to a certain number of child items from those it deems most relevant to the current query. > **Important** > > The index uses the `sortCriteria` of the current query to determine the order in which to fold the results. > > [example] > .Example If the current `sortCriteria` is `date descending`, the index folds the most recent replies of an email conversation first under their parent. ##### You can easily override this by specifying a value for the `rearrange` option of the `Folding` component. ====