Example #1
0
        public override DocIdSet GetDocIdSet(AtomicReaderContext context, IBits acceptDocs)
        {
            SortedDocValues fcsi = FieldCache.GetTermsIndex((context.AtomicReader), field);
            FixedBitSet     bits = new FixedBitSet(fcsi.ValueCount);

            for (int i = 0; i < terms.Length; i++)
            {
                int ord = fcsi.LookupTerm(terms[i]);
                if (ord >= 0)
                {
                    bits.Set(ord);
                }
            }
            return(new FieldCacheDocIdSet(context.Reader.MaxDoc, acceptDocs, (doc) =>
            {
                int ord = fcsi.GetOrd(doc);
                if (ord == -1)
                {
                    // missing
                    return false;
                }
                else
                {
                    return bits.Get(ord);
                }
            }));
        }
            protected internal override sealed bool MatchDoc(int doc)
            {
                int ord = fcsi.GetOrd(doc);

                if (ord == -1)
                {
                    // missing
                    return(false);
                }
                else
                {
                    return(bits.Get(ord));
                }
            }