Doc Items Filtering Examples - AFS

AFS Integration Guide

Product
AFS
AFS_Version
7.9
Category
Reference Guide

Find hereafter some examples of document items filtering.

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>red</color>
</variant>
<variant id="02">
<size>L</size>
<color>blue</color>
</variant>
<store id="01">
${City}Lambesc</city>
<price devise="eur">15</price>
</store>
<store id="02">
${City}Paris</city>
<price devise="eur">20</price>
</store>
</tshirt>

is processed using the following 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/variante">
<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>
</afs:set>

<!--Set 2-->
<afs:set id="magasin" XPath="/tshirt/magasin">
<afs:item XPath="./ville">
<afs:index weight="75"/>
</afs:item>

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

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

  • query: ...&afs:filter=size="XL" and color="Red"&...

<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">
<titre>titre tshirt 01</titre>
<description>description tshirt 01</description>
<brand>nake</brand>
<variant id="01">
<size>XL</size>
<color>red</color>
</variant>
<store id="01">
${City}Lambesc</city>
<price devise="eur">15</price>
</store>
<store id="02">
${City}Paris</city>
<price devise="eur">20</price>
</store>
</tshirt>
</afs:clientData>
</afs:reply>
</afs:content>
</afs:replySet>

  • query: ...&afs:select=size="XL" and color="Red"&...

<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">
<titre>titre tshirt 01</titre>
<description>description tshirt 01</description>
<brand>nake</brand>
<variant id="01">
<size>XL</size>
<color>red</color>
</variant>
</tshirt>
</afs:clientData>
</afs:reply>
</afs:content>
</afs:replySet>

  • query: ...&afs:filter=size="XL"%20and%20color="blue"&...

<afs:replySet>
</afs:replySet>

  • query: …&afs:select=size="XL" with color="blue"&...

<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>
<variant id="02">
<size>L</size>
<color>blue</color>
</variant>
</tshirt>
</afs:clientData>
</afs:reply>
</afs:content>
</afs:replySet>