@Override public int andNotSize(DocSet other) { if (other instanceof BitDocSet) { // if we don't know our current size, this is faster than // size - intersection_size return (int)OpenBitSet.andNotCount(this.bits, ((BitDocSet)other).bits); } else { return super.andNotSize(other); } }
public Filter getTopFilter() { final OpenBitSet bs = getBits();
public int andNotSize(DocSet other) { return this.size() - this.intersectionSize(other); }
public boolean equals(Object obj) { if (!(obj instanceof DocSet)) return false; DocSet other = (DocSet)obj; if (this.size() != other.size()) return false; if (this instanceof DocList && other instanceof DocList) { // compare ordering DocIterator i1=this.iterator(); DocIterator i2=other.iterator(); while(i1.hasNext() && i2.hasNext()) { if (i1.nextDoc() != i2.nextDoc()) return false; } return true; // don't compare matches } // if (this.size() != other.size()) return false; return this.getBits().equals(other.getBits()); }
public int intersectionSize(DocSet other) { // intersection is overloaded in the smaller DocSets to be more // efficient, so dispatch off of it instead. if (!(other instanceof BitDocSet)) { return other.intersectionSize(this); } // less efficient way: do the intersection then get it's size return intersection(other).size(); }
/** * Inefficient base implementation. * * @see BitDocSet#getBits */ public OpenBitSet getBits() { OpenBitSet bits = new OpenBitSet(); for (DocIterator iter = iterator(); iter.hasNext();) { bits.set(iter.nextDoc()); } return bits; };
public int unionSize(DocSet other) { return this.size() + other.size() - this.intersectionSize(other); }
public DocSet union(DocSet other) { OpenBitSet newbits = (OpenBitSet)(this.getBits().clone()); newbits.or(other.getBits()); return new BitDocSet(newbits); }
public DocSet andNot(DocSet other) { OpenBitSet newbits = (OpenBitSet)(this.getBits().clone()); newbits.andNot(other.getBits()); return new BitDocSet(newbits); }
public DocSet intersection(DocSet other) { // intersection is overloaded in the smaller DocSets to be more // efficient, so dispatch off of it instead. if (!(other instanceof BitDocSet)) { return other.intersection(this); } // Default... handle with bitsets. OpenBitSet newbits = (OpenBitSet)(this.getBits().clone()); newbits.and(other.getBits()); return new BitDocSet(newbits); }