Hello there, I have a situation that for the specified coden, volume, issue, if article is good, a collection is set.
I want to count the total articles in this issue and then the count of articles that have collection set. The following is my query: import module namespace search="http://marklogic.com/appservices/search" at "/MarkLogic/appservices/search/search.xqy"; let $coden := "JBOPFO" let $opnode := <options xmlns="http://marklogic.com/appservices/search"> <constraint name="coden"> <value> <element ns="ns" name="article-coden"/> </value> </constraint> <constraint name="volume"> <value> <element ns="ns" name="article-volume"/> </value> </constraint> <constraint name="issue"> <value> <element ns="ns" name="article-issue"/> </value> </constraint> <constraint name="collection"> <collection prefix="/myplatform/" /> </constraint> <term> <term-option>case-insensitive</term-option> </term> <page-length>10</page-length> <return-constraints>false</return-constraints> <return-facets>true</return-facets> <return-metrics>false</return-metrics> <return-qtext>false</return-qtext> <return-query>false</return-query> <return-results>false</return-results> </options> return let $str := fn:concat("coden:AAA volume:9 issue:1") let $ret := search:search($str, $opnode) let $prod-total-cnt := fn:data($ret/search:fac...@name eq "collection"]/search:facet-val...@name = "test"]/@count) let $total-cnt := fn:data($ret/@total) return ( $prod-total-cnt, " --- ", $total-cnt) , $ret ) I got return like: 14 --- 27 <search:response total="27" start="1" page-length="10" xmlns:search="http://marklogic.com/appservices/search"> <search:facet name="collection"> <search:facet-value name="test" count="14">test</search:facet-value> </search:facet> </search:response> I think search:response/@total holds the total article count for total-cnt, and search:response/search:fac...@name eq "collection"]/search:facet-val...@name = "test"]/@coun holds count for $prod-total-cnt. For this issue I checked all the articles, they all have collection set, so I expect that the two count are the same. But I don't understand why I have different count from this search. Can anyone tell me where I'm wrong? Thanks, Helen
_______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
