Hi Jason,

Your understanding is correct. I tried it using some other data and it seems 
work fine.

The only problem here is that we have very large set of data, adding a new 
element means all the data has to be touched to build the new element for this 
search. It pretty much means that any time I want to do something like this, I 
have to change all the data to construct the new element to fit the search, 
this is based on the new requirement.  Do we have any function similar to 
cts:element-values()  but it works on field like cts:field-values()? What I'm 
trying to think is: the refauthor is simple element, it only has fname and 
surname, if I can create a field which combines the value of refauthor, then 
this field will serve as the same functionality as the new element 
<referencedauthor>.

Or any other work around?  But the bottom line is if this is the only way then 
I'll change all the data for it, I'll do it.

Thanks, Helen


From: Jason Hunter <[email protected]<mailto:[email protected]>>
Reply-To: 
"[email protected]<mailto:[email protected]>" 
<[email protected]<mailto:[email protected]>>
Date: Tue, 3 May 2011 13:25:24 -0700
To: "[email protected]<mailto:[email protected]>" 
<[email protected]<mailto:[email protected]>>
Subject: Re: [MarkLogic Dev General] question about search

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]<mailto:[email protected]>>
Reply-To: 
"[email protected]<mailto:[email protected]>" 
<[email protected]<mailto:[email protected]>>
Date: Tue, 3 May 2011 13:08:58 -0700
To: "[email protected]<mailto:[email protected]>" 
<[email protected]<mailto:[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]<mailto:[email protected]>
http://developer.marklogic.com/mailman/listinfo/general

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

_______________________________________________ General mailing list 
[email protected]<mailto:[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