Simon Gaeremynck | 1 Jul 2010 12:16
Picon
Gravatar

Query totals - approximations.

First off I know the question has been asked many times before whether
 it is possible to get an accurate count from query results.
I know Jackrabbit only loads the next result when it really has to, which is fine
since it gives a great performance boost.
And I also know you can "trick/force" Jackrabbit to return a total by adding a sort in there but that's not
really what we want.

So we thought we might take a Google approach where we say
  "Displaying first 10 results of approximately 1400000."

Some more info about this:
Now, to do this we thought we could get the hit count from Lucene, get the first 10 nodes,
keep a record of how many Lucene Documents we had to iterate over to get those first 10
and then do a very rudimentary approximation of how many nodes the user would be able to see for this query.

ie:
1.  Lucene returns a total hitcount of 1.523.145
2.  We fetch the first 10 Nodes which results in 452 Documents that needed to be processed but could not be used
because the user doesn't have READ access.
3.  Based on these 2 numbers we approximate that the user can see 3370 Nodes.
4.  We round this number off to 3300 just to indicate that it's unlikely we guessed right.
5.  The UI displays a message in likes of:
        "
          Displaying page 1 of approximately 330
          Showing 10 results per page.
        "

Now I had a look at how Jackrabbit executes queries and there seem to be 3 ways it gets the QueryHits (in JackrabbitIndexSearcher.evaluate)
- Check if it is a JackrabbitQuery and let the Query implementation deal with it.
- It is not a JackrabbitQuery and there is no sort required -- use LuceneQueryHits
(Continue reading)

Christian Wurbs | 1 Jul 2010 12:46

isModified for SubTree

Hello all,

Is there a possibility to check for modifications in a nodes subtree -
instead of walking through all children and always accessing the network?

Thx in advance.

Christian Wurbs

Niu, Xuetao | 1 Jul 2010 13:08

Transactional versioning examples?

Hello,

I failed finding any transaction examples of using Jackrabbit2.0. Could
any of you provide one?

I need to have versioning behaviors transactional. My problem is that
before I checkout a node, I need to first save the current session. But
what if the checkin failed after my changes are saved? How can I
rollback the previously saved session changes?

Thanks a lot!

Xuetao

Niu, Xuetao | 1 Jul 2010 13:11

RE: Transactional versioning examples?

My problematic code is like this:

VersionManager vm = getSession().getWorkspace().getVersionManager();

vm.checkout(path);                  

doMyVersioning();

// I have to same before checking in, what if checkin failed? How can I
rollback?

getSession().save();                

Version v = vm.checkin(path);

From: Niu, Xuetao 
Sent: Thursday, July 01, 2010 1:08 PM
To: users <at> jackrabbit.apache.org
Subject: Transactional versioning examples?

Hello,

I failed finding any transaction examples of using Jackrabbit2.0. Could
any of you provide one?

I need to have versioning behaviors transactional. My problem is that
before I checkout a node, I need to first save the current session. But
what if the checkin failed after my changes are saved? How can I
rollback the previously saved session changes?

(Continue reading)

Norman Maurer | 1 Jul 2010 13:59
Picon
Favicon

Chroot webdav per user

Hi,

is it somehow possible to chroot to a dynamic node when a user login
via webdav ? For example I have the structure

/mailboxes/#mail/u/user1
/mailboxes/#mail/u/user2

When user1 logs in I would like to chroot to:
/mailboxes/#mail/u/user1

For user2:
/mailboxes/#mail/u/user1

So is this possible somehow ?

Thx,
Norman

Fabián Mandelbaum | 1 Jul 2010 14:29
Picon

Got authentication warning after migration from 1.4 to 1.6

Hello there,

I've had to migrate JackRabbit jars from 1.4.12 to 1.6.2, because
1.6.2 contained a fix we needed. After this migration, which went
smoother than I thought (just replace the needed jars and restart the
application), I'm having this warning in the logs (I didn't have such
a thing before):

2010-07-01 09:26:23,838  WARN
org.apache.jackrabbit.core.security.authentication.AbstractLoginModule:273
- No credentials available -> try default (anonymous) authentication.

What may be causing this? Everything works as expected, but this
warning wasn't there with 1.4.

Thanks in advance for your answers.

--

-- 
Fabián Mandelbaum
IS Engineer

Benjamin Brown | 1 Jul 2010 15:11

RE: ImportXML and checked-in nodes

In response to my own post and in case anyone else notices the (seeming) lack of feature for importing
versioned nodes the following methods should handle the problem (where the path argument is the parent
path of the root node being imported). There may still be other issues with it such as references which I've
not dealt with.

	private void checkOutNodesPreImport(Session session, String path) throws PathNotFoundException,
RepositoryException {
		Node n = (Node)session.getItem(path);
		if (!n.isCheckedOut()) {
			n.checkout();
		} 
		NodeIterator iter = n.getNodes();
		if (iter != null && iter.hasNext()) {
			Node subNode = iter.nextNode();
			checkOutNodesPreImport(session, subNode.getPath());
		}
	}

	private void checkInNodesPostImport(Session session, String path) throws PathNotFoundException,
RepositoryException {
		Node n = (Node)session.getItem(path);
		if (n.isModified()) {
			n.save();
		}
		if (n.isCheckedOut()) {
			n.checkin();
		} 
		NodeIterator iter = n.getNodes();
		if (iter != null && iter.hasNext()) {
			Node subNode = iter.nextNode();
(Continue reading)

Xiaojie Shen | 1 Jul 2010 16:49
Favicon

How to recover a deleted document in Jackrabbit?

Hello
It seems files are still maintained in datastore after they are deleted. Are version indexes also maintained?
How are the files under
/jackrabbit-webapp_default/server/default/jcr:root/jcr:system/jcr:versionStorage/...
connected to the document storage?
It is hard to get a clue from the coded file storage structure. How can administrator recover a deleted document?
Thanks in advance!
Shen

Ard Schrijvers | 1 Jul 2010 22:45

Re: Query totals - approximations.

hello Simon,

On Thu, Jul 1, 2010 at 12:16 PM, Simon Gaeremynck <gaeremyncks <at> gmail.com> wrote:
> First off I know the question has been asked many times before whether
>  it is possible to get an accurate count from query results.
> I know Jackrabbit only loads the next result when it really has to, which is fine
> since it gives a great performance boost.
> And I also know you can "trick/force" Jackrabbit to return a total by adding a sort in there but that's not
really what we want.
>
> So we thought we might take a Google approach where we say
>  "Displaying first 10 results of approximately 1400000."

Note that Google has, apart from the number of data, obviously quite
an easy job: there is no authorization involved. If you are using
Gmail, check out the number of results they show you there: first 20
of hundreds, or 'first 20 of thousands' : Also note, that gmail is an
entirely domain specific solution, where, it should be easier to show
actual hitcounts.

Obviously, I do not want to talk about Google, but want to give you an
idea about the complexity: Authorized exact counting when you have a
fine grained accessmanager can only be shown correctly if you
authorize every Lucene hit. Extrapolating like you do below is imo
really not a very well solution, see below:

>
> Some more info about this:
> Now, to do this we thought we could get the hit count from Lucene, get the first 10 nodes,
> keep a record of how many Lucene Documents we had to iterate over to get those first 10
(Continue reading)

Rencana Tarigan | 2 Jul 2010 04:44
Picon
Favicon
Gravatar

Re: Search Query

How to make it work for sub folder too ?

On 6/30/2010 6:43 PM, David Gough wrote:
> Hi Rencana,
>
> Try
>
> //element(*, nt:file)[jcr:contains(jcr:
>    
>> path, '//"searchText"')]
>>
>>      
> or failing that:
>
> //element(*, nt:file)[jcr:like(jcr:
>    
>> path, '//"*searchText*"')]
>>
>>      
> regards
>
> Dave
>
>
>
> On Mon, Jun 21, 2010 at 4:41 PM, Rencana Tarigan<
> rencana_tarigan <at> yahoo.co.id>  wrote:
>
>    
>> I have path /cana.txt but when i use this query the result is empty..
(Continue reading)


Gmane