FileDocCategorySizeDatePackage
ModifiedEntryFilter.javaAPI DocApache Lucene 2.1.02654Wed Feb 14 10:46:04 GMT 2007org.apache.lucene.gdata.utils

ModifiedEntryFilter

public class ModifiedEntryFilter extends Filter
The {@link ModifiedEntryFilter} filters the given entryIds from the lucene {@link org.apache.lucene.search.Hits} set. This filter is used to prevent the storage from retrieving already deleted or updated entries still remaining in the {@link org.apache.lucene.gdata.storage.lucenestorage.StorageBuffer}.
see
org.apache.lucene.search.Filter
author
Simon Willnauer

Fields Summary
private static final long
serialVersionUID
private final String[]
entyIds
private final String
searchField
Constructors Summary
public ModifiedEntryFilter(String[] entryIds, String field)
Creates a new {@link ModifiedEntryFilter}

param
entryIds the entry id's to filter
param
field - the field, the id is stored

                                      
          
        super(); 
        this.searchField = field;
        this.entyIds = entryIds; 
    
Methods Summary
public java.util.BitSetbits(org.apache.lucene.index.IndexReader reader)

see
org.apache.lucene.search.Filter#bits(org.apache.lucene.index.IndexReader)

 
        BitSet bitSet = new BitSet(reader.maxDoc()); 
        bitSet.flip(0, reader.maxDoc()); // set all documents  
        int[] docs = new int[1]; 
        int[] freq = new int[1]; 
        for (String id : this.entyIds) { 
            if (id != null) { 
                TermDocs termDocs = reader.termDocs(new Term( 
                        this.searchField, id)); 
                int count = termDocs.read(docs, freq); 
                if (count == 1) 
                    bitSet.flip(docs[0]); 
 
            } 
        } 
 
        return bitSet;