Hi,

I have a problem using the cts:search() facility.

I am looking for documents that (a) contain a ukm:Year element whose 
Value attribute is 1985 and (b) contain a leg:P1group element with a 
RestrictExtent attribute whose value is 'E+W'.

If I do:

cts:search(
   collection('best'),
   cts:and-query((
     cts:element-attribute-range-query(xs:QName("ukm:Year"), QName("", 
"Value"), "=", 1985),
     cts:element-attribute-value-query(xs:QName("leg:P1group"), 
QName("", "RestrictExtent"), "E+W")
   )),
   'unfiltered'
)/base-uri(.)

I get back a single document (1985 c. 12).

If I do what I think is the equivalent query:

cts:search(
   collection('best'),
   cts:element-attribute-value-query(xs:QName("leg:P1group"), QName("", 
"RestrictExtent"), "E+W"),
   'unfiltered'
)[.//ukm:Year/@Value = 1985]/base-uri(.)

I get back two documents (1985 c. 12 and 1985 c. 67; actually multiple 
copies of the second because it's an unfiltered search and the relevant 
document contains several matching P1groups).

So two questions:

1. Why is the first query not giving me back the same results as the 
second query? Is this to do with fragments or something?

2. What would be the most efficient way of performing this search while 
retaining the accurate results given by the second of the above expressions?

Thank you,

Jeni

P.S. MarkLogic v. 4.1-7
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to