jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Grathwohl <jan.grathw...@kontrast.de>
Subject NodeIterator drops nodes when sorting
Date Wed, 28 May 2008 10:19:19 GMT
Hi,

we are having the problem in our application that an XPath query does  
not return all results that should be in it. Some debugging through  
the Jackrabbit internals showed us that the NodeIterator from the  
query result received the right UUIDs from the Lucene index, but then  
removed some of them from the list because the sorting of the results  
failed.

The situation is that we have some nodes in the results list where  
not all of the node's ancestors are accessible for the Session  
(blocked by our AccessManager). We receive a DocOrderNodeIteratorImpl  
from the query that contains these nodes, and this iterator tries to  
sort the nodes before the first method call that accesses them. The  
comparator then gets an AccessDeniedException from the getAncestor()  
of one of the nodes, and removes these nodes with unaccessable  
ancestors from the node list. It also looks like the Comparator  
directly removes both compared nodes from the result list if one of  
them throws an Exception when being compared.

Is this wanted behaviour, that nodes won't be returned by a query  
when they cannot be sorted? And is it generally supported in  
JackRabbit to have nodes whose ancestors are not accessible?

We could work around that by turning off the sorting of the nodes, we  
don't need sorted query results here. Is there a way to achieve this  
trough JCR or Jackrabbit API? We are currently doing this by  
accessing the private  
org.apache.jackrabbit.core.query.lucene.QueryImpl object from the  
query result through Java reflection, and then calling a  
setRespectDocumentOrder(false) on it. But maybe there is a nicer way  
(as probably almost any way would be nicer) to achieve the same result?

I will attach the XPath query and Exception stack trace from our log  
file.

Best regards and Thanks,

Jan


15:55:53,194 DEBUG [tcmdataaccess] QueryString is: //element(*,  
tcs:category) [fn:lower-case(@tcs:defaultContentType) =  
'information'] /element(*, tcs:categorylocalization) [ @tcs:locview =  
'pngo' and @tcs:loclanguage = 'de']
15:56:41,836 ERROR [DocOrderNodeIteratorImpl] Exception while sorting  
nodes in document order: javax.jcr.AccessDeniedException: cannot read  
item 827cae10-ad2e-44ad-927f-a65e96e0d4f2
javax.jcr.AccessDeniedException: cannot read item 827cae10- 
ad2e-44ad-927f-a65e96e0d4f2
	at org.apache.jackrabbit.core.ItemManager.getItem(ItemManager.java:392)
	at org.apache.jackrabbit.core.ItemManager.getNode(ItemManager.java:350)
	at org.apache.jackrabbit.core.ItemImpl.getAncestor(ItemImpl.java:1403)
	at org.apache.jackrabbit.core.query.lucene.DocOrderNodeIteratorImpl 
$1.compare(DocOrderNodeIteratorImpl.java:220)
	at java.util.Arrays.mergeSort(Arrays.java:1284)
	at java.util.Arrays.mergeSort(Arrays.java:1295)
	at java.util.Arrays.sort(Arrays.java:1223)
	at  
org.apache.jackrabbit.core.query.lucene.DocOrderNodeIteratorImpl.initOrd 
eredIterator(DocOrderNodeIteratorImpl.java:172)
	at  
org.apache.jackrabbit.core.query.lucene.DocOrderNodeIteratorImpl.hasNext 
(DocOrderNodeIteratorImpl.java:131)
	at  
kontrast.toshiba.datastore.accessimpl.content.search.ContentSearchImpl.g 
etContentList(ContentSearchImpl.java:267)
	at  
kontrast.toshiba.datastore.accessimpl.content.search.ContentSearchImpl.f 
indContents(ContentSearchImpl.java:187)
	at  
kontrast.toshiba.datastore.accessimpl.content.search.ContentSearchImpl.p 
erformQuery(ContentSearchImpl.java:117)
	at  
kontrast.toshiba.datastore.accessimpl.content.search.ContentSearchImpl.g 
etResults(ContentSearchImpl.java:89)
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message