afs:displayChildren - AFS

AFS Integration Guide

Product
AFS
AFS_Version
7.9
Category
Reference Guide

Role

The afs:displayChildren=true|false (default : true) query option is designed to allow users to display or not all child document items of a document item that matched the query.

Status

This parameter is optional and can be used only together with the afs:select parameter.

It applies to all afs:select parameters provided in the query.

It is useful only if the feed.xml contains a hierarchy of afs:set elements, ie at least one afs:set child of another afs:set.

If a document containing document items matches the query, and within this document if a father document item matches the query, then the afs:displayChildren parameter will trigger (if set to true) or not the display of all child items of that item.

Note that displaying child items may impact the facet counts related to these items.

Examples

See below.

The following document:

<tshirt id="1">
<title>title tshirt 01</title>
<description>description tshirt 01</description>
<brand>nake</brand>
<variant id="01">
<size>XL</size>
<color>rouge</color>
<store id="01">
${City}Lambesc</city>
<price devise="eur">15</price>
</store>
</variant>
<variant id="02">
<size>L</size>
<color>bleu</color>
<store id="02">
${City}Paris</city>
<price devise="eur">20</price>
</store>
</variant>
</tshirt>

is processed using this feed.xml indexing filter configuration:

<afs:item XPath="/tshirt">
<afs:store clientData="file" highlight="true"/>
</afs:item>

<!--Set 1-->
<afs:set id="variante" XPath="/tshirt/variant">

<afs:item XPath="./size">
<afs:index weight="75"/>
<afs:facet id="size">
<afs:label>Size</afs:label>
<afs:nodes>
<afs:id XPath="."/>
<afs:label xml:lang="en" XPath="."/>
</afs:nodes>
</afs:facet>
</afs:item>

<afs:item XPath="./color">
<afs:index weight="75"/>
<afs:facet id="color">
<afs:label>Color</afs:label>
<afs:nodes>
<afs:id XPath="."/>
<afs:label xml:lang="en" XPath="."/>
</afs:nodes>
</afs:facet>
</afs:item>


<!--Set 2-->
<afs:set id="store" XPath="store">
<afs:item XPath="./city">
<afs:index weight="75"/>
</afs:item>

<afs:item XPath="./price">
<afs:index weight="75"/
</afs:item>
</afs:set>

</afs:set>

On reply side, the following queries will produce the following results:

  • query: ...&afs:select=size="XL"&afs:displayChildren=false

<afs:replySet>
<afs:meta uri="SELECT" totalItems="1" totalItemsIsExact="true" pageItems="1" firstPageItem="1" lastPageItem="1" durationMs="4" firstPaFId="2" lastPaFId="2" producer="search"/>
<afs:facets/>
<afs:content>
<afs:reply docId="2" uri="1">
<afs:abstract>
<afs:text>description tshirt 01</afs:text>
</afs:abstract>
<afs:relevance rank="1"/>
<afs:clientData id="file" mimeType="text/xml">
<tshirt id="1">
<title>title tshirt 01</title>
<description>description tshirt 01</description>
<brand>nike</brand>
<variant id="01">
<size>XL</size>
<color>red</color>
</variant>
</tshirt>
</afs:clientData>
</afs:reply>
</afs:content>
</afs:replySet>

  • query: ...&afs:select=size="XL"&afs:displayChildren=true

<afs:replySet>
<afs:meta uri="SELECT" totalItems="1" totalItemsIsExact="true" pageItems="1" firstPageItem="1" lastPageItem="1" durationMs="4" firstPaFId="2" lastPaFId="2" producer="search"/>
<afs:facets/>
<afs:content>
<afs:reply docId="2" uri="1">
<afs:abstract>
<afs:text>description tshirt 01</afs:text>
</afs:abstract>
<afs:relevance rank="1"/>
<afs:clientData id="file" mimeType="text/xml">
<tshirt id="1">
<title>title tshirt 01</title>
<description>description tshirt 01</description>
<brand>nike</brand>
<variant id="01">
<size>XL</size>
<color>red</color>
<store id="01">
${City}Lambesc</city>
<price devise="eur">15</price>
</store>
</variant>
</tshirt>
</afs:clientData>
</afs:reply>
</afs:content>
</afs:replySet>