When you specify multiple QNames, it just ORs them together, so this is what I 
would expect.



From: [email protected] 
[mailto:[email protected]] On Behalf Of Andreas Hubmer
Sent: Tuesday, May 26, 2015 9:18 AM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] cts:element-values and fragment-frequency 
with multiple element names

Hi there,

Can anybody tell me whether this is a bug or a feature?

Thanks,
Andreas

2015-05-13 17:08 GMT+02:00 Andreas Hubmer 
<[email protected]<mailto:[email protected]>>:
Hi,

cts:frequency returns unexpected values when called on an item retrieved with 
cts:element-values on multiple elements and the option "fragment-frequency".

Let me give an example:
xquery version "1.0-ml";
(: an element range index is needed for both elements "a" and "b" :)
xdmp:document-insert("/test.xml",
  <root>
    <a>A</a>
    <a>A</a>
    <b>A</b>
  </root>)
;
for $val in cts:element-values((xs:QName("a"), xs:QName("b")), (), 
"fragment-frequency")
  return $val || ": " || cts:frequency($val)

I would expect that the fragment frequency of the value "A" is 1. But the 
result is 2 because MarkLogic seems to count the frequencies of the two 
elements a and b separately and return the sum.
When using item frequency the result is 3, as expected.

Is this a bug or a feature? In case of the latter it would be nice to document 
this behavior.

As a workaround, to get the "real" fragment frequency I will use a field range 
index and cts:field-values

Regards,
Andreas

--
Andreas Hubmer
IT Consultant

Email: [email protected]<mailto:[email protected]>
Web: http://www.ebcont.com

OUR TEAM IS YOUR SUCCESS

UID-Nr. ATU68135644
HG St.Pölten - FN 399978 d

_______________________________________________
General mailing list
[email protected]
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to