Example #1
0
        public override DocIdSet getDocIdSet(IndexReader reader)
        {
            var bitCount = reader.maxDoc();
            var bits     = new OpenBitSet(bitCount);

            if (_exclude)
            {
                bits.set(0, bitCount);
            }

            var docs         = new int[1];
            var freqs        = new int[1];
            var termTemplate = new Term(_fieldName);

            foreach (string special in _specials)
            {
                TermDocs termDocs = reader.termDocs(termTemplate.createTerm(special));
                int      count    = termDocs.read(docs, freqs);
                if (count == 1)
                {
                    if (_exclude)
                    {
                        bits.fastClear(docs[0]);
                    }
                    else
                    {
                        bits.fastSet(docs[0]);
                    }
                }
            }

            return(bits);
        }
Example #2
0
        public override DocComparator getComparator(IndexReader reader, int docBase)
        {
            var bitCount  = reader.maxDoc();
            var docValues = new OpenBitSet(bitCount);

            if (_exclude)
            {
                docValues.set(0, bitCount);
            }

            var docs         = new int[1];
            var freqs        = new int[1];
            var termTemplate = new Term(_fieldName);

            foreach (string special in _specials)
            {
                TermDocs termDocs = reader.termDocs(termTemplate.createTerm(special));
                int      count    = termDocs.read(docs, freqs);
                if (count == 1)
                {
                    if (_exclude)
                    {
                        docValues.fastClear(docs[0]);
                    }
                    else
                    {
                        docValues.fastSet(docs[0]);
                    }
                }
            }

            return(new SpecialsComparator(docValues));
        }