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 <jhun...@marklogic.com<mailto:jhun...@marklogic.com>> Reply-To: "general@developer.marklogic.com<mailto:general@developer.marklogic.com>" <general@developer.marklogic.com<mailto:general@developer.marklogic.com>> Date: Tue, 3 May 2011 13:08:58 -0700 To: "general@developer.marklogic.com<mailto:general@developer.marklogic.com>" <general@developer.marklogic.com<mailto:general@developer.marklogic.com>> 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 General@developer.marklogic.com<mailto:General@developer.marklogic.com> http://developer.marklogic.com/mailman/listinfo/general _______________________________________________ General mailing list General@developer.marklogic.com<mailto:General@developer.marklogic.com> http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________ General mailing list General@developer.marklogic.com http://developer.marklogic.com/mailman/listinfo/general