[MarkLogic Dev General] Facet name + frequency

Geert Josten Geert.Josten at daidalos.nl
Mon Oct 4 23:55:15 PDT 2010


Hi Mano,

There is a little inconsistency in your mail. Your code uses xs:QName("group"), but you mention to 'have created index for the "groupdesc" field'. Did you also create an element value index for element "group"?

Kind regards,
Geert

>


drs. G.P.H. (Geert) Josten
Consultant

Daidalos BV
Hoekeindsehof 1-4
2665 JZ Bleiswijk

T +31 (0)10 850 1200
F +31 (0)10 850 1199

mailto:geert.josten at daidalos.nl
http://www.daidalos.nl/

KvK 27164984


De informatie - verzonden in of met dit e-mailbericht - is afkomstig van Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit bericht kunnen geen rechten worden ontleend.

> From: general-bounces at developer.marklogic.com
> [mailto:general-bounces at developer.marklogic.com] On Behalf Of mano m
> Sent: maandag 4 oktober 2010 15:11
> To: general at developer.marklogic.com
> Subject: [MarkLogic Dev General] Facet name + frequency
>
> Hi
>
>  My xmls will be in the format given below:
> Xml
> <item>
> <id>10202</id>
> <Name>Herbal cream</Name>
> <group>
> <id>i1</id>
> <description> cream product</description> </group> <method>
>             <id>md128</id>
>             <description>herbal</description> </method>
> <groupdesc> cream product </groupdesc> (:Indexed based on
> this group element:) <item>
>
> Query
>
> <facet name="group"> {
> for $x in cts:element-values(xs:QName("group"),"",$options ,
>   cts:word-query("herbal")[1 to 10])
> order by cts:frequency($x) descending
> return
> (
>  <int name={$x}>{cts:frequency($x)}</int>
> )
> } </facet>
>
>
> I have created index for the "groupdesc" field and getting
> the facet result with frequency as given below:
>
>
> Current Output:
> <facet name="group">
> <int name="cream product" > 1</int>
> <int name="oil product" > 3</int>
> .
> </facet>
>
> But the result should be in the format given below. That is
> facet name is a combination of the <group> elements <id> and
> <description> values
>
> Expected output:
> <facet name="group">
> <int name=" i1 cream product" > 1</int>
> <int name=" i2 oil product" > 3</int>
> ...
>
> </facet>
>
>  Can anyone help me in attaining the expected output?
>
>
> Thanks in advance
>
>
> Regards,
> Mano
>
>
>


More information about the General mailing list