You can use cts:frequency($author) to get the number of times the author was 
cited.  If the same person might be cited multiple times in an article and you 
want to count that, you'll want to specify "item-frequency" as an option to the 
cts:element-values() call.  The default "fragment-frequency" would count 
several citations in the same article as just one.

Hopefully I'm understanding what you want.

-jh-

On May 3, 2011, at 1:15 PM, Helen Chen wrote:

> Hi Jason,
> 
> cts:element-values() will return me the unique list the referencedauthor, but 
> it does not tell me which one shows up (or cited) most.  The basic idea is: 
> based on how many times of each refauthor showed up, and the search returns 
> the top 1 or top 5 refauthor.
> 
> Does field help this?
> 
> Thanks,
> Helen
> 
> 
> 
> From: Jason Hunter <[email protected]>
> Reply-To: "[email protected]" <[email protected]>
> Date: Tue, 3 May 2011 13:08:58 -0700
> To: "[email protected]" <[email protected]>
> Subject: Re: [MarkLogic Dev General] question about search
> 
> Hi Helen,
> 
> Add an element like <referencedauthor>James Wang</referencedauthor> in the 
> document, perhaps in a new metadata block up top.  Put a range index on the 
> chosen QName of type xs:string.  Then use cts:element-values() to extract the 
> referenced authors.  You can pass a cts:query call to the function if you 
> want to limit to just articles matching a query.  This approach will be fast 
> at scale.  With the content shaped like you have right now, there's not an 
> optimized way to do this at scale.
> 
> -jh-
> 
> On May 3, 2011, at 12:13 PM, Helen Chen wrote:
> 
>> Hello there,
>> 
>> We have article xml in marklogic, inside each article, it lists the 
>> references that this article cited. I want to do a search to find out that 
>> inside /article/back/reference/citation/ref/jcite, which author is 
>> referenced most, or I can get a list of top 5  refauth who shows up in the 
>> reference section  most in article.  
>> 
>> The article structure like the following:
>> <article>
>>     <front>…</front>
>>     <back>
>>         <references>
>>             <citation id="c1">
>>                 <ref>
>>                     <jcite>
>>                         <refauth>
>>                             <fname>James</fname>
>>                             <surname>Wang</surname>
>>                         </refauth>
>>                         <jtitle>article title</jtitle>
>>                         <coden>AAA</coden>
>>                         <issn>1111</issn>
>>                         <volume>1</volume>
>>                         <pages>90</pages>
>>                         <date>2007</date>
>>                     </jcite>
>>                 </ref>
>>             </citation>
>>         </references>
>>         <references>
>>             <citation id="c2">
>>                 <ref>
>>                     <jcite>
>>                         <refauth>
>>                             <fname>Tom</fname>
>>                             <surname>Ding</surname>
>>                         </refauth>
>>                         <jtitle>my article title</jtitle>
>>                         <coden>AAB</coden>
>>                         <issn>1112</issn>
>>                         <volume>1</volume>
>>                         <pages>20</pages>
>>                         <date>2008</date>
>>                     </jcite>
>>                 </ref>
>>             </citation>
>>         </references>
>>     </back>
>> </article>
>> 
>> 
>> Can anyone give me a suggestion how to do it? Or how to start ?
>> 
>> Thanks, helen
>> _______________________________________________
>> General mailing list
>> [email protected]
>> http://developer.marklogic.com/mailman/listinfo/general
> 
> _______________________________________________ General mailing list 
> [email protected] 
> http://developer.marklogic.com/mailman/listinfo/general
> _______________________________________________
> General mailing list
> [email protected]
> http://developer.marklogic.com/mailman/listinfo/general

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

Reply via email to