pulse - the web application framework Get pulse at SourceForge.net. Fast, secure and Free Open Source software downloads Ohloh project report for pulse-java

org.torweg.pulse.util.search
Class SitemapNodeRoleFilterFactory.SitemapNodeRoleFilter

java.lang.Object
  extended by org.apache.lucene.search.Filter
      extended by org.torweg.pulse.util.search.SitemapNodeRoleFilterFactory.SitemapNodeRoleFilter
All Implemented Interfaces:
java.io.Serializable
Enclosing class:
SitemapNodeRoleFilterFactory

public static class SitemapNodeRoleFilterFactory.SitemapNodeRoleFilter
extends org.apache.lucene.search.Filter

The filter checking whether the filter's roles are part of the document roles.

Version:
$Revision: 1415 $
Author:
Thomas Weber
See Also:
Serialized Form

Constructor Summary
SitemapNodeRoleFilterFactory.SitemapNodeRoleFilter(java.util.Set<Role> roles)
          creates a new filter for the given set of roles.
 
Method Summary
 org.apache.lucene.search.DocIdSet getDocIdSet(org.apache.lucene.index.IndexReader reader)
          does the actual filtering.
 
Methods inherited from class org.apache.lucene.search.Filter
bits
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SitemapNodeRoleFilterFactory.SitemapNodeRoleFilter

public SitemapNodeRoleFilterFactory.SitemapNodeRoleFilter(java.util.Set<Role> roles)
creates a new filter for the given set of roles.

Parameters:
roles - the roles
Method Detail

getDocIdSet

public final org.apache.lucene.search.DocIdSet getDocIdSet(org.apache.lucene.index.IndexReader reader)
                                                    throws java.io.IOException
does the actual filtering.

One bit set (A) collects all documents with roles set. Another bit set (B) collects all documents with a role whose id is contained in the filter's ids.

The result is computed as follows:
not(A) or B
So not(A) represents all documents without a role. Thus the results are either documents without a role or with a role which is in the filter's set of roles.

Overrides:
getDocIdSet in class org.apache.lucene.search.Filter
Parameters:
reader - the index reader
Returns:
a bit set with the results to be included
Throws:
java.io.IOException - on errors accessing the index
See Also:
Filter.getDocIdSet(org.apache.lucene.index.IndexReader)