I'm trying to get accurate unfiltered results using the following 2 records. I have the default fragmentation and really do not want to further fragment the document (as I realize that could help fix my problem but at the expense of many, many fragments). From way back when, I seem to recall a trick where you could 'nest' element-query elements to leverage a document structure and still get accurate unfiltered results. But, the tricks (as I remember them) do not appear to be working. My guess is that the tricks don't work when a range index is involved because the concept of 'word position' (for the element/value associated with the range index) within the document has been lost. Of course, I could also be completely wrong.
Here is my simple XML for the 2 records. <metadata> <doc>1</doc> <manifestation> <fmt>xml</fmt> <ts>2012-01-13T13:56:12.484283-05:00</ts> </manifestation> <manifestation> <fmt>html</fmt> <ts>2012-01-11T13:56:12.484283-05:00</ts> </manifestation> </metadata> <metadata> <doc>2</doc> <manifestation> <fmt>xml</fmt> <ts>2012-01-10T13:56:12.484283-05:00</ts> </manifestation> <manifestation> <fmt>html</fmt> <ts>2012-01-12T13:56:12.484283-05:00</ts> </manifestation> </metadata> I created an element range index of type xs:dateTime on the ts element. Here is my query. cts:search(collection(), cts:element-query(QName("","manifestation"), cts:and-query( (cts:element-value-query((QName("","fmt")),"xml"), cts:element-range-query((QName("","ts")), ">", xs:dateTime("2012-01-11T13:56:12.484283-05:00"))) ) ), ("unfiltered") ) I get 2 results for this query (the correct result is 1). I then tried to modify the document structure as follows: <metadata> <doc>1</doc> <manifestation> <fmt ts="2012-01-13T13:56:12.484283-05:00">xml</fmt> </manifestation> <manifestation> <fmt ts="2012-01-11T13:56:12.484283-05:00">html</fmt> </manifestation> </metadata> <metadata> <doc>2</doc> <manifestation> <fmt ts="2012-01-10T13:56:12.484283-05:00">xml</fmt> </manifestation> <manifestation> <fmt ts="2012-01-12T13:56:12.484283-05:00">html</fmt> </manifestation> </metadata> I created an element attribute range index of type xs:dateTime on the fmt element and ts attribute. Here is my query. cts:search(collection(), cts:element-query(QName("","manifestation"), cts:and-query( (cts:element-value-query((QName("","fmt")),"xml"), cts:element-attribute-range-query((QName("","fmt")), (QName("","ts")), ">", xs:dateTime("2012-01-11T13:56:12.484283-05:00"))) ) ), ("unfiltered") ) Once again, I get 2 results for this query. I then tried to modify the document structure as follows: <metadata> <doc>1</doc> <xml> <ts>2012-01-13T13:56:12.484283-05:00</ts> </xml> <html> <ts>2012-01-11T13:56:12.484283-05:00</ts> </html> </metadata> <metadata> <doc>2</doc> <xml> <ts>2012-01-10T13:56:12.484283-05:00</ts> </xml> <html> <ts>2012-01-12T13:56:12.484283-05:00</ts> </html> </metadata> I created an element range index of type xs:dateTime on the ts element. Here is my query. cts:search(collection(), cts:element-query(QName("","xml"), cts:element-range-query((QName("","ts")), ">", xs:dateTime("2012-01-11T13:56:12.484283-05:00")) ), ("unfiltered") ) Once again, 2 results. I realize that I should be able to fix this if I modified my XML as follows: <metadata> <doc>2</doc> <xml ts="2012-01-10T13:56:12.484283-05:00"/> <html ts="2012-01-12T13:56:12.484283-05:00"/> </metadata> But, that is really not preferable as I may not necessarily know all of the possible values for 'fmt' (xml, html, etc.) in advance. So, I'm curious if anyone else has any other ideas that I might try (I'm using 4.2-8) so if perhaps something like this works in 5.0 please let me know. As an aside, a nice feature request might be to allow the specification of a range index if the local-name matches a 'pattern' instead of an exact match. Something like SOLR allows with the specification of 'dynamic fields'. Thanks. Darin. _______________________________________________ General mailing list General@developer.marklogic.com http://developer.marklogic.com/mailman/listinfo/general