Inheritance: Lucene.Net.Search.DocIdSet, IBits
        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);
        }
Beispiel #2
0
        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;
        }
Beispiel #3
0
 /// <summary>
 /// Makes full copy.
 /// </summary>
 /// <param name="other"></param>
 public FixedBitSet(FixedBitSet other)
 {
     bits = new BitArray(other.bits);
 }
Beispiel #4
0
 public FixedBitSetIterator(FixedBitSet bitset)
 {
     enumerator = bitset.bits.GetEnumerator();
 }
Beispiel #5
0
        /* 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);
        }
Beispiel #6
0
        /* 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);
        }