Ok let me explain my requirement, may be you can me some suggest better 
approach .


We have Facet on
Location which goes to three level (Region-->Country-->City)
Content Type goes to two level (Content Type-->Content Sub Type)

Now we have Standard data of all Location & Content Type in one XML, not sure 
everything will be tagged. :fn:doc($TAX_DOC)/taxonomy/taxonomyItem:)

Now I need to build a Tree UI for my facet value.

So what I am doing Read XML file first, on each item check  its exists in 
"search:facet/search:facet-value". Then build a XML which will appear like
Later build a UI in Jquery or EXTJS and consume this XML or JSON data

<facet name="contenttype">
<level1></level1>
<level1>
<level2>
<level2>
</level1>
<level1></level1>
</facet>
<facet name="location">
<level1></level1>
<level1>
<level2>
<level2>
</level1>
<level1></level1>
</facet>


How we are doing currently , almost same approach for creating tree UI but we 
are building UI also in XQUERY so instead of element we are doing like this. 
This is not code friendly, it's tough to understand and also make changes
<Div>
<Div class="facet"><span>Content Type</span>
<UL>
<li></li>
<li>
<div class="expanding">
<ul>
<li>
<li>
</ul>
</div>
</li>
<li></li>
</UL>
</Div>
<Div class="facet"><span>Location </span>
<UL>
<li></li>
<li>
<div class="expanding">
<ul>
<li>
<li>
</ul>
</div>
</li>
<li></li>
</UL>
</Div>
</DIV>



Your suggestion


~Gurbeer
From: [email protected] 
[mailto:[email protected]] On Behalf Of Mihir Das
Sent: Tuesday, May 14, 2013 12:28 AM
To: [email protected]
Subject: Re: [MarkLogic Dev General] Building Facet UI

Hi,

Probably, you are looking for <return-results>false</return-results> option to 
yield facets ONLY.

But it seems you are comparing facets value with XML file and re-creating a new 
XML based on your business logic. I think there will be some performance impact 
in comparison. Could you please describe more about your requirement, specially 
in iteration part?

Cheers,
Mihir


Message: 2
Date: Mon, 13 May 2013 16:50:06 +0000
From: "Singh, Gurbeer" 
<[email protected]<mailto:[email protected]>>
Subject: [MarkLogic Dev General] Building Facet UI
To: "[email protected]<mailto:[email protected]>"
        
<[email protected]<mailto:[email protected]>>
Message-ID:
        
<[email protected]<mailto:[email protected]>>
Content-Type: text/plain; charset="us-ascii"

Hi

Need some suggestion to build UI from Facet

I want to restructure my Facet UI code, just want to make sure I am taking 
right approach

Search:search will give result + facet result

I have a XML which contains all meta data of facet. XML file name is Taxonomy

This algorithm I am planning to follow


let $result:=search:search('policy', $config:OPTIONS, 
1)/search:facet/search:facet-value

                                for $taxonomyItem in 
fn:doc($TAX_DOC)/taxonomy/taxonomyItem
<div><B> $taxonomyItem/@name </B>
<UL>
                                                                                
for $level1 in $taxonomyItem/level1
                                                                                
                if($result/@name eq $level1/@name) then (: compare result facet 
value text and XML file value TEXT:)
                                                                                
                <LI> $level1/@name   {xdmp:quote($result[@name eq 
$level1/@name]/@count)} (:Showing Facet value and count:)
                                                                                
                                if (fn:exists($level1/level2)) then
<UL>
                                                                                
                                                for $level2 in $level1/level2
                                                                                
                                                                
if($result/@name eq $level2/@name) then
                                                                                
                                                                
<LI>$level2/@name  {xdmp:quote($result[@name eq $level2/@name]/@count)}    
</LI> els()
</UL> else()
</LI>
</UL>
</DIV>


________________________________

NOTICE: Morgan Stanley is not acting as a municipal advisor and the opinions or 
views contained herein are not intended to be, and do not constitute, advice 
within the meaning of Section 975 of the Dodd-Frank Wall Street Reform and 
Consumer Protection Act. If you have received this communication in error, 
please destroy all electronic and paper copies and notify the sender 
immediately. Mistransmission is not intended to waive confidentiality or 
privilege. Morgan Stanley reserves the right, to the extent permitted under 
applicable law, to monitor electronic communications. This message is subject 
to terms available at the following link: 
http://www.morganstanley.com/disclaimers If you cannot access these links, 
please notify us by reply message and we will send the contents to you. By 
messaging with Morgan Stanley you consent to the foregoing.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
http://developer.marklogic.com/pipermail/general/attachments/20130513/3d04dc3f/attachment.html

------------------------------

_______________________________________________
General mailing list
[email protected]<mailto:[email protected]>
http://developer.marklogic.com/mailman/listinfo/general


End of General Digest, Vol 107, Issue 28
****************************************



________________________________

NOTICE: Morgan Stanley is not acting as a municipal advisor and the opinions or 
views contained herein are not intended to be, and do not constitute, advice 
within the meaning of Section 975 of the Dodd-Frank Wall Street Reform and 
Consumer Protection Act. If you have received this communication in error, 
please destroy all electronic and paper copies and notify the sender 
immediately. Mistransmission is not intended to waive confidentiality or 
privilege. Morgan Stanley reserves the right, to the extent permitted under 
applicable law, to monitor electronic communications. This message is subject 
to terms available at the following link: 
http://www.morganstanley.com/disclaimers If you cannot access these links, 
please notify us by reply message and we will send the contents to you. By 
messaging with Morgan Stanley you consent to the foregoing.
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to