Hi Selven,

I am not entirely sure, but it is such a common pattern, that I wouldn't be 
surprised if the search application builder, shipped with MarkLogic Server 
4.1+, would do all of that for you. Or otherwise, the underlying API might help 
you set this up relatively easy.

You can find the Application Builders Developer's Guide, and also the Search 
Developer's Guide here:

http://developer.marklogic.com/pubs/4.1/default.xqy

Kind regards,
Geert



Drs. G.P.H. Josten
Consultant




<http://www.daidalos.nl/>
Daidalos BV
Source of Innovation
Hoekeindsehof 1-4
2665  JZ  Bleiswijk
Tel.: +31 (0) 10 850 1200
Fax: +31 (0) 10 850 1199
www.daidalos.nl<http://www.daidalos.nl/>
KvK 27164984


De informatie - verzonden in of met dit emailbericht - 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: [email protected] 
[mailto:[email protected]] On Behalf Of Selven Xavier
Sent: vrijdag 9 oktober 2009 9:10
To: [email protected]
Subject: [MarkLogic Dev General] Frequency of word occurrence using 
cts:frequency for Suggest functionality

Hi Team,
In Google, when we start typing a word, an auto drop down list is displayed 
with suggested list and frequency of word occurrence. Similarly we are planning 
to implement in our application.

Is there any way to achieve using cts:frequency?

Since cts:frequency use value lexicon APIs (i.e. cts:element-values, 
cts:element-attribute-values); we need to created a range index against any 
node element which allow us to suggest a list and the frequency based on the 
value of the node but not based on words in that node.


Following is code snippet which gives us suggested value and the frequency of 
the value by not suggested word in that node. Can anyone help us to get the 
frequency of a word for the suggested list?

declare namespace e="http://www.simonandschuster.com/namespaces/sands_pub";;
let $searchword:= "All"
let $suggestResult :=
cts:element-word-match(fn:QName("http://www.simonandschuster.com/namespaces/sands_pub","title";),concat($searchword<http://www.simonandschuster.com/namespaces/sands_pub%22,%22title%22),concat($searchword>,"*")
 ,("case-insensitive","ascending","limit=10"))
for $a in $suggestResult
let $b := cts:element-values(xs:QName("e:title"),$a,("item-frequency"))[1]
return <result>{($a,fn:concat("---------         ",cts:frequency($b)))}</result>

Thanks in Advance.

Thanks & Regards,
Selven Xavier .A




_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to