Merge pull request #467 from giastfader/master

New patch for issue #195
Merge pull request #470 from giastfader/master

fix and tests for #469 (wrong count(*) with permissions)
Merge pull request #471 from giastfader/master

fixed DocumentCountFunctionalTest for Java 6
Merge pull request #50 from baasbox/master

update from origin master