I am using ML 7, and trying to do a grouped search.  In my test below, 
this_partner is 2 partners, split by the / character.  In the search, it would 
then search one, then the other.  I was hoping in the return, using 
fn:distinct-values(), I would only return the record if it had not already 
returned it.  In fact, it seemed to work that way in Qconsole but when I 
applied it to my query on the server, it would return a duplicate result for 
each record.

I am assuming what I am doing below is inadequate to get the result I am 
looking for, but the failure doesn't produce an exception.

Any suggestion for what might be better?

I was going to try distinct-nodes instead but I don't think that's available in 
ML7, is that true?

xquery version "1.0-ml";
declare namespace html = "http://www.w3.org/1999/xhtml";;

let $this_partner:="Benefits Pro/Life Health Pro"
let $this_partner:= fn:tokenize($this_partner,"/")

let $search-this-partner:=
cts:search(fn:doc(),cts:and-query((
  cts:element-value-query(xs:QName("almmediapartner"),$this_partner),
  cts:element-query(xs:QName("approval_status"),cts:word-query("true")),
cts:element-attribute-range-query(xs:QName("EventStartDate"), xs:QName("date"), 
">=", xs:date(fn:current-date()) )
)))


return if(fn:distinct-values($search-this-partner/event/doc-uri) ) then
   $search-this-partner/event/(EventTitle|doc-uri)
   else ()

Results in Qconsole >>

<EventTitle>Test Record Title</EventTitle>
<doc-uri>/data-sources/events/BenefitsandLifeHealthPartners:2016-03-04-05:00:58.xml</doc-uri>

Results from server online >>

Test Record Title
Test Record Title





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

Reply via email to