Index: org/opencms/search/CmsSearchIndex.java =================================================================== RCS file: /usr/local/cvs/opencms/src/org/opencms/search/CmsSearchIndex.java,v retrieving revision 1.54 diff -u -r1.54 CmsSearchIndex.java --- org/opencms/search/CmsSearchIndex.java 27 Jun 2005 23:22:16 -0000 1.54 +++ org/opencms/search/CmsSearchIndex.java 9 Aug 2005 21:20:41 -0000 @@ -623,12 +623,14 @@ end = hitCount; } - for (int i = 0, cnt = 0; i < hitCount && cnt < end; i++) { + // effectiveHitCount is the total hitCount subtracted by the number of hits, to which the user has no read access + int effectiveHitCount = hitCount; + for (int i = 0, cnt = 0; i < hitCount; i++) { try { doc = hits.doc(i); if (hasReadPermission(cms, doc)) { // user has read permission - if (cnt >= start) { + if (cnt >= start && cnt < end) { // do not use the resource to obtain the raw content, read it from the lucene document ! if (m_createExcerpt) { excerpt = getExcerpt( @@ -640,6 +642,10 @@ searchResults.add(searchResult); } cnt++; + } else { + + // the user has no read access to this resource, so this resource should not be counted + effectiveHitCount--; } } catch (Exception e) { // should not happen, but if it does we want to go on with the next result nevertheless @@ -650,7 +656,7 @@ } // save the total count of search results at the last index of the search result - searchResults.setHitCount(hitCount); + searchResults.setHitCount(effectiveHitCount); } else { searchResults.setHitCount(0); }