From: Patrick B. <pat...@jo...> - 2012-07-23 19:33:03
|
Don't need the (), they were just left over from me trying different things to see if any worked. There are multiple people per document. All of the documents are attached so you can see for your self. I've tried replacing the ".//" with descendant::, same effect. Also tried breaking the ands into individual predicates. So: collection("/db/tickets")//ticket[.//person[@has_signed_off = 'no'][./username = 'pat...@jo...'][./role = 'approver']] that returns a slightly different result, but one that is still incorrect. (probably worth looking at as well actually) Also, as another note, turning the query rewriter off didn't seem to have any impact. On Mon, Jul 23, 2012 at 3:21 PM, Dmitriy Shabanov <sha...@gm...>wrote: > My fast guess that './/' near person can be the problem place .... and/or > 'and' instead of set of '[...]' filters .... and/or '(...)' . last most > possible case. Why you need '(...)'? > > Also to clear 3rd expression, do you have only one person under ticket? > On Jul 23, 2012 11:36 PM, "Patrick Bosek" <pat...@jo...> > wrote: > >> Hi everyone, >> >> I'm on eXist 2 trunk ( >> https://exist.svn.sourceforge.net/svnroot/exist/trunk/eXist) >> >> I've got some pretty puzzling results coming back from an XPath >> expression I'm running. I have a collection of documents, and I'm selecting >> them based on some conditions of their sub nodes. Here is an example xpath: >> >> //ticket[.//person[(@has_signed_off = 'no' and ./username = ' >> pat...@jo...' and ./role = 'approver')]] >> >> It appears each condition is evaluated independently, so as long as a the >> document has .//person[@has_signed_off = "no"] and .//person[./username = ' >> pat...@jo...] and .//person[./role = 'approver'] it will be >> returned. >> >> So, in essence eXist appears to consider these two xpaths equivalent: >> >> //ticket[.//person[(@has_signed_off = 'no' and ./username = ' >> pat...@jo...' and ./role = 'approver')]] >> >> //ticket[.//person[@has_signed_off = "no"] and .//person[./username = ' >> pat...@jo...] and .//person[./role = 'approver']] >> >> Which (as far as I understand) is not correct. Running the two queries in >> oXygen I get the results I would expect from each, which is 2 out of the 5 >> example documents being matched for the first and all 5 being matched for >> the second. In eXist I get all 5 for both. >> >> >> I've attached a backup of the database, the xquery I'm running, and an >> xml with each of the documents in it that I have used to test the queries >> in oXygen to make sure they are performing as I would expect. >> >> Thanks! >> >> -- >> Patrick Bosek >> Jorsek Software >> Cell (585) 820 9634 >> Office (877) 492 2960 >> Jorsek.com >> >> >> >> ------------------------------------------------------------------------------ >> Live Security Virtual Conference >> Exclusive live event will cover all the ways today's security and >> threat landscape has changed and how IT managers can respond. Discussions >> will include endpoint security, mobile security and the latest in malware >> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >> _______________________________________________ >> Exist-open mailing list >> Exi...@li... >> https://lists.sourceforge.net/lists/listinfo/exist-open >> >> -- Patrick Bosek Jorsek Software Cell (585) 820 9634 Office (877) 492 2960 Jorsek.com |