public override DocIdSet GetDocIdSet(IndexReader reader) { var result = new FixedBitSet(reader.MaxDoc()); var fields = reader.GetFieldNames(IndexReader.FieldOption.ALL); if (fields == null || fields.Count == 0) { return(result); } String lastField = null; TermsEnumCompatibility termsEnum = null; foreach (Term term in terms) { var f = term.Field(); if (!f.Equals(lastField)) { var termsC = new TermsEnumCompatibility(reader, f); if (termsC.Term() == null) { return(result); } termsEnum = termsC; lastField = f; } if (terms != null) { // TODO this check doesn't make sense, decide which variable its supposed to be for Debug.Assert(termsEnum != null); if (termsEnum.SeekCeil(term.Text()) == TermsEnumCompatibility.SeekStatus.FOUND) { termsEnum.Docs(result); } } } return(result); }
public override DocIdSet GetDocIdSet(IndexReader reader) { var result = new FixedBitSet(reader.MaxDoc); var fields = reader.GetFieldNames(IndexReader.FieldOption.ALL); if (fields == null || fields.Count == 0) { return result; } String lastField = null; TermsEnumCompatibility termsEnum = null; foreach (Term term in terms) { if (!term.Field.Equals(lastField)) { var termsC = new TermsEnumCompatibility(reader, term.Field); if (termsC.Term() == null) { return result; } termsEnum = termsC; lastField = term.Field; } if (terms != null) { // TODO this check doesn't make sense, decide which variable its supposed to be for Debug.Assert(termsEnum != null); if (termsEnum.SeekCeil(term.Text) == TermsEnumCompatibility.SeekStatus.FOUND) { termsEnum.Docs(result); } } } return result; }
/// <summary> /// Makes full copy. /// </summary> /// <param name="other"></param> public FixedBitSet(FixedBitSet other) { bits = new BitArray(other.bits); }
public FixedBitSetIterator(FixedBitSet bitset) { enumerator = bitset.bits.GetEnumerator(); }
/* Does in-place AND NOT of the bits provided by the * iterator. */ //public void AndNot(DocIdSetIterator iter) //{ // var obs = iter as OpenBitSetIterator; // if (obs != null && iter.DocID() == -1) // { // AndNot(obs.arr, obs.words); // // advance after last doc that would be accepted if standard // // iteration is used (to exhaust it): // obs.Advance(bits.Length); // } // else // { // int doc; // while ((doc = iter.NextDoc()) < bits.Length) // { // Clear(doc); // } // } //} /* this = this AND NOT other */ public void AndNot(FixedBitSet other) { AndNot(other.bits, other.bits.Length); }
/* Does in-place OR of the bits provided by the * iterator. */ //public void Or(DocIdSetIterator iter) //{ // if (iter is OpenBitSetIterator && iter.DocID() == -1) // { // var obs = (OpenBitSetIterator)iter; // Or(obs.arr, obs.words); // // advance after last doc that would be accepted if standard // // iteration is used (to exhaust it): // obs.Advance(bits.Length); // } // else // { // int doc; // while ((doc = iter.NextDoc()) < bits.Length) // { // Set(doc); // } // } //} /* this = this OR other */ public void Or(FixedBitSet other) { Or(other.bits, other.bits.Length); }