@Test public void getDocIdSet() throws IOException { IndexSearcher searcher = new IndexSearcher(reader); Query query = new TermQuery(new Term("path", "home")); TopDocs docs = searcher.search(query, filter, 2); assertEquals(1, docs.totalHits); Document doc = reader.document(docs.scoreDocs[0].doc); assertEquals("branch2", doc.get(PageIndex.BRANCH)); }
@Override public DocIdSet getDocIdSet(AtomicReaderContext context, Bits acceptDocs) { int docBase = context.docBase; BitSet result = new BitSet(); int acceptDocsLen = (acceptDocs != null) ? acceptDocs.length() : -1; for (int i = docBase; i < visibleDocIdsLength; i++) { int resultIdx = i - docBase; if ((acceptDocsLen >= 0) && (resultIdx >= acceptDocsLen)) { break; } if (visibleDocIds.get(i) && ((acceptDocs == null) || acceptDocs.get(resultIdx))) { result.set(resultIdx); } } return new DocIdBitSet(result); }
PagePermissionFilter extends Filter { @Override public DocIdSet getDocIdSet(AtomicReaderContext context, Bits acceptDocs) { int docBase = context.docBase; BitSet result = new BitSet(); int acceptDocsLen = (acceptDocs != null) ? acceptDocs.length() : -1; for (int i = docBase; i < visibleDocIdsLength; i++) { int resultIdx = i - docBase; if ((acceptDocsLen >= 0) && (resultIdx >= acceptDocsLen)) { break; } if (visibleDocIds.get(i) && ((acceptDocs == null) || acceptDocs.get(resultIdx))) { result.set(resultIdx); } } return new DocIdBitSet(result); } }
PagePermissionFilter extends Filter { @Override public DocIdSet getDocIdSet(AtomicReaderContext context, Bits acceptDocs) { int docBase = context.docBase; BitSet result = new BitSet(); int acceptDocsLen = (acceptDocs != null) ? acceptDocs.length() : -1; for (int i = docBase; i < visibleDocIdsLength; i++) { int resultIdx = i - docBase; if ((acceptDocsLen >= 0) && (resultIdx >= acceptDocsLen)) { break; } if (visibleDocIds.get(i) && ((acceptDocs == null) || acceptDocs.get(resultIdx))) { result.set(resultIdx); } } return new DocIdBitSet(result); } PagePermissionFilter(Bits visibleDocIds); }
PagePermissionFilter extends Filter { @Override public DocIdSet getDocIdSet(AtomicReaderContext context, Bits acceptDocs) { int docBase = context.docBase; BitSet result = new BitSet(); int acceptDocsLen = (acceptDocs != null) ? acceptDocs.length() : -1; for (int i = docBase; i < visibleDocIdsLength; i++) { int resultIdx = i - docBase; if ((acceptDocsLen >= 0) && (resultIdx >= acceptDocsLen)) { break; } if (visibleDocIds.get(i) && ((acceptDocs == null) || acceptDocs.get(resultIdx))) { result.set(resultIdx); } } return new DocIdBitSet(result); } PagePermissionFilter(Bits visibleDocIds); @Override DocIdSet getDocIdSet(AtomicReaderContext context, Bits acceptDocs); }
PagePermissionFilter extends Filter { @Override public DocIdSet getDocIdSet(AtomicReaderContext context, Bits acceptDocs) { int docBase = context.docBase; BitSet result = new BitSet(); int acceptDocsLen = (acceptDocs != null) ? acceptDocs.length() : -1; for (int i = docBase; i < visibleDocIdsLength; i++) { int resultIdx = i - docBase; if ((acceptDocsLen >= 0) && (resultIdx >= acceptDocsLen)) { break; } if (visibleDocIds.get(i) && ((acceptDocs == null) || acceptDocs.get(resultIdx))) { result.set(resultIdx); } } return new DocIdBitSet(result); } PagePermissionFilter(Bits visibleDocIds); @Override DocIdSet getDocIdSet(AtomicReaderContext context, Bits acceptDocs);  }