From: Jens Ø. P. <oe...@gm...> - 2011-11-28 11:20:08
|
On Nov 28, 2011, at 10:45 AM, Lars Buitinck wrote: > 2011/11/25 Lars Buitinck <L.J...@uv...>: >> I've put a sample file, the one with the single mention of "Boeing", >> as well as my collection.xconf at >> http://staff.science.uva.nl/~buitinck/exist-bug/. Thanks for looking >> into this. > > Okay, we managed to resolve the error with ft:query. Thanks to Jens > for an (off-list) nod in the right direction: testing the text with > contains caused exactly the same error. > > It turns out that ft:query was not to blame, but util:catch. We still > don't know exactly what went wrong, but when we didn't wrap ft:query > in util:catch, the error went away. > > Since we do need to catch exceptions from Lucene (and XQuery 3.0 > exception handling is not available in eXist 1.4), we replaced the > XPath expression > > collection('/db/documents')/root[.//house[@type eq "commons"]//scene This cannot have been the actual expression - I assume it was let $scope := collection('/db/documents')/root[.//house[@type eq "commons"]]//scene in order to close the braces. Testing this in 1.4.2: xquery version "1.0"; declare namespace pm="http://www.politicalmashup.nl"; (:let $scope := collection('/db/documents')//scene[ancestor::root//pm:house/@type eq 'commons']:) (: full-text gives 1 result :) let $scope := collection('/db/documents')/root[.//pm:house[@type eq 'commons']]//scene (: full-text gives 14 results :) (:$scope := collection('/db/documents')//scene:) (: full-text gives 1 result :) return $scope[ft:query(., 'Boeing')] (:return $scope[contains(., 'Boeing')]:) The first let statement is the one that Lars describes below. It gives the correct result (1 scene). The second let statement is the one Lars wanted to have working, emended as described above. It gives an erroneous result (14 scenes). The third let statement is the one Lars started out with. It applies no filter. Since $scope has the same sequence of 14 scenes with all three let statements, it is hard to understand why the result of full-text filtering this sequence in the return statement should differ. As far as I see, this applies to full-text filtering only: the second let statement returns the single correct result if filtered with contains(). Lars' files are at <http://staff.science.uva.nl/~buitinck/exist-bug/>. If there is a difference, it should be easy to make a much more general test. Best, Jens > > with > > $coll//scene[ancestor::root//pm:house/@type eq $house] > > which for some reason does not trigger the bug. (We're still at a loss > why the latter works, while the former doesn't.) > > > -- > Lars Buitinck > Scientific programmer, ILPS > University of Amsterdam |