List of usage examples for org.apache.lucene.util FixedBitSet xor
public void xor(DocIdSetIterator iter) throws IOException
From source file:org.geotoolkit.lucene.filter.SerialChainFilter.java
License:Open Source License
@Override public DocIdSet getDocIdSet(final LeafReaderContext ctx, final Bits b) throws CorruptIndexException, IOException { final int chainSize = chain.size(); final int actionSize = actionType.length; final FixedBitSet bits = (FixedBitSet) ((BitDocIdSet) chain.get(0).getDocIdSet(ctx, b)).bits(); //if there is only an operand not we don't enter the loop int j = 0;/*from w ww. j av a 2 s . c o m*/ if (actionType[j] == NOT) { bits.flip(0, ctx.reader().maxDoc()); j++; } for (int i = 1; i < chainSize; i++) { LogicalFilterType action; if (j < actionSize) { action = actionType[j]; j++; } else { action = DEFAULT; } final FixedBitSet nextFilterResponse = (FixedBitSet) ((BitDocIdSet) chain.get(i).getDocIdSet(ctx, b)) .bits(); //if the next operator is NOT we have to process the action before the current operand if (j < actionSize && actionType[j] == NOT) { nextFilterResponse.flip(0, ctx.reader().maxDoc()); j++; } switch (action) { case AND: bits.and(nextFilterResponse); break; case OR: bits.or(nextFilterResponse); break; case XOR: bits.xor(nextFilterResponse); break; default: bits.or(nextFilterResponse); break; } } // invalidate deleted document return invalidateDeletedDocument(bits, b); }