[MarkLogic Dev General] Frequency and Search Results in 3.2

Ian Small ian at marklogic.com
Wed May 23 14:47:46 PDT 2007


Bilal -
 
It's not clear what you're trying to accomplish from the code fragment
below, since your use of cts:element-query() on QName kwd as a filter to
the value lexicon on element QName kwd is puzzling to me.
 
If you'd like to explain what your objective is, we might be able to
suggest a simpler code fragment, and then address why things do or don't
match.  At a glance, the code fragment you've provided is (sort of)
doing two different things between the element-values()/frequency call
and the xdmp:estimate() call.  But I'd rather start from your objective
than try to unwind this code sample.
 
Cheers
ian

________________________________

From: general-bounces at developer.marklogic.com
[mailto:general-bounces at developer.marklogic.com] On Behalf Of Bilal
Khalid
Sent: Wednesday, May 23, 2007 2:40 PM
To: general at developer.marklogic.com
Subject: [MarkLogic Dev General] Frequency and Search Results in 3.2


Hello All,

I've been trying to resolve the frequency count (retrieved through a
function like cts:element-values) into actual search results in 3.2, but
the number of results does not match the frequency count. The example
below shows the query I've been trying out in CQ. 

let $elem := cts:element-values(xs:QName("kwd"), "",
("frequency-order","fragment-frequency"),
cts:element-query(xs:QName("kwd"), "water"))[1]
let $freq := cts:frequency($elem) 
let $cnt := xdmp:estimate(cts:search(doc(),
cts:element-query(xs:QName("kwd"), $elem)))
return concat ($elem, " (freq: ", $freq, ") (search: ", $cnt, ")")

Please note that I use cts:element-query in both lexicon and search
queries. The only difference is that the search parameter in the second
query is changed to the first item of the results from the lexicon. 

-Bilal 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://xqzone.marklogic.com/pipermail/general/attachments/20070523/e905641e/attachment.html


More information about the General mailing list