Hi Geert,

Yes, the collation in the code is the collation I used to set the element-range 
indexes.

I actually tried to do the query without specifying the collation like 
following, and I tried to take collation out one by one, but marklogic 
complains that there is no element range index for it, so I have to put 
collation there.

cts:element-values(fn:QName("nsjps","publication_year"),(),   ("ascending"), 
                               cts:and-query((
                               
cts:element-range-query(fn:QName("nsjps","coden"), "=", "AAA",  ()),
                               
cts:element-range-query(fn:QName("nsjps","volume"), "=", "12",  ()) 
                                            ), ())
                                         )


Helen

On May 6, 2010, at 12:33 PM, Geert Josten wrote:

> Hi Helen,
>  
> You are using a particular collation in your code. Do all indexes specify 
> this same collation?
>  
> Kind regards,
> Geert
> 
>  
>  
> drs. G.P.H. (Geert) Josten
> Consultant
>  
> <[email protected]>
> 
> Daidalos BV
> Hoekeindsehof 1-4
> 2665 JZ Bleiswijk
> 
> T +31 (0)10 850 1200
> F +31 (0)10 850 1199
>  
> [email protected]
> www.daidalos.nl
>  
> KvK 27164984
> 
> P Please consider the environment before printing this mail.
> De informatie - verzonden in of met dit e-mailbericht - is afkomstig van 
> Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit 
> bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit 
> bericht kunnen geen rechten worden ontleend.
> From: [email protected] 
> [mailto:[email protected]] On Behalf Of helen chen
> Sent: donderdag 6 mei 2010 18:13
> To: General Mark Logic Developer Discussion
> Cc: helen chen
> Subject: [MarkLogic Dev General] question on query
> 
> I have a query works on one structure but not on another set of structure, I 
> couldn't see the clue,
> 
> for the working one:  our data is like in the following structure
> <article>...<coden></coden><volume></volume><issue></issue><paper></paper>...</article>
> 
> the following are examples of the data, each tag <article> means one xml in 
> marklogic:
> 
> article 1:  
> <article>...<coden>AAA</coden><volume>1</volume><issue>1</issue><paper>123</paper>....</article>
> article 2: 
> <article>....<coden>AAA</coden><volume>1</volume><issue>2</issue><paper>233</paper>...</article>
> ...
> 
> I want to get issue list for the coden and volume, so I use the query
> 
> cts:element-values(fn:QName("ns1","issue"),(),  
> ("collation=http://marklogic.com/collation/en/MO";, "descending"), 
>                                cts:and-query((
>                                
> cts:element-range-query(fn:QName("ns1","coden"), "=", "AAA",   
> "collation=http://marklogic.com/collation/en/MO";),
>                                
> cts:element-range-query(fn:QName("ns1","volume"), "=", "1",   
> "collation=http://marklogic.com/collation/en/MO";) 
>                                             ))                                
>     )
> 
> this one works very good, and it gives me the correct issue list for 
> different coden/volume.
> 
> ------- for the not working one:
> I have another situation that I want to use query similar with the above one:
> I have xml file structure like : <jps xmlns="nsjps"> <coden></coden> 
> <volume></volume> <publication_year></publication_year></jps>
> 
> the following every line is one xml file
> ...
> <jps xmlns="nsjps"> <coden>AAA</coden> <volume>12</volume> 
> <publication_year>1968</publication_year></jps>
> <jps xmlns="nsjps"> <coden>AAA</coden> <volume>11</volume> 
> <publication_year>1967</publication_year></jps>
> <jps xmlns="nsjps"> <coden>AAA</coden> <volume>10</volume> 
> <publication_year>1966</publication_year></jps>
> <jps xmlns="nsjps"> <coden>AAB</coden> <volume>15</volume> 
> <publication_year>1978</publication_year></jps>
> ...
> 
> here every coden and volume should have unique value as publication_year. I 
> thought if I use the following query for coden=AAA and volume=12, I should 
> get only 1968 as return, but I got all the values for all the 
> publication_year for coden=AAA and volume=12, which is 1968, 1967, 1966...
> 
> cts:element-values(fn:QName("nsjps","publication_year"),(),    
> ("collation=http://marklogic.com/collation/en/MO";, "descending"), 
>                                cts:and-query((
>                                
> cts:element-range-query(fn:QName("nsjps","coden"), "=", "AAA",  
> "collation=http://marklogic.com/collation/en/MO";),
>                                
> cts:element-range-query(fn:QName("nsjps","volume"), "=", "12",   
> "collation=http://marklogic.com/collation/en/MO";) 
>                                             ))
>                                          )
> 
> 
> Any one can help me?
> 
> 
> 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

Reply via email to