/// <summary>
        /// Map each term to the single group that contains it </summary>
        private IDictionary <Term, int> TermGroups(LinkedHashMap <Term, int?> tord, IList <FixedBitSet> bb)
        {
            Dictionary <Term, int> tg = new Dictionary <Term, int>();

            Term[] t = tord.Keys.ToArray(/*new Term[0]*/);
            for (int i = 0; i < bb.Count; i++) // i is the group no.
            {
                DocIdSetIterator bits = bb[i].GetIterator();
                int ord;
                while ((ord = bits.NextDoc()) != NO_MORE_DOCS)
                {
                    tg[t[ord]] = i;
                }
            }
            return(tg);
        }
Esempio n. 2
0
        /// <summary>
        /// Map each term to the single group that contains it </summary>
        private static IDictionary <Term, int> TermGroups(JCG.LinkedDictionary <Term, int?> tord, IList <FixedBitSet> bb) // LUCENENET: CA1822: Mark members as static
        {
            Dictionary <Term, int> tg = new Dictionary <Term, int>();

            Term[] t = tord.Keys.ToArray(/*new Term[0]*/);
            for (int i = 0; i < bb.Count; i++) // i is the group no.
            {
                DocIdSetIterator bits = bb[i].GetIterator();
                int ord;
                while ((ord = bits.NextDoc()) != NO_MORE_DOCS)
                {
                    tg[t[ord]] = i;
                }
            }
            return(tg);
        }
Esempio n. 3
0
            public override Scorer FilteredScorer(AtomicReaderContext context, Weight weight, DocIdSet docIdSet)
            {
                DocIdSetIterator filterIter = docIdSet.GetIterator();

                if (filterIter == null)
                {
                    // this means the filter does not accept any documents.
                    return(null);
                }

                int firstFilterDoc = filterIter.NextDoc();

                if (firstFilterDoc == DocIdSetIterator.NO_MORE_DOCS)
                {
                    return(null);
                }

                IBits filterAcceptDocs = docIdSet.Bits;
                // force if RA is requested
                bool useRandomAccess = filterAcceptDocs != null && UseRandomAccess(filterAcceptDocs, firstFilterDoc);

                if (useRandomAccess)
                {
                    // if we are using random access, we return the inner scorer, just with other acceptDocs
                    return(weight.GetScorer(context, filterAcceptDocs));
                }
                else
                {
                    if (Debugging.AssertsEnabled)
                    {
                        Debugging.Assert(firstFilterDoc > -1);
                    }
                    // we are gonna advance() this scorer, so we set inorder=true/toplevel=false
                    // we pass null as acceptDocs, as our filter has already respected acceptDocs, no need to do twice
                    Scorer scorer = weight.GetScorer(context, null);
                    // TODO once we have way to figure out if we use RA or LeapFrog we can remove this scorer
                    return((scorer == null) ? null : new PrimaryAdvancedLeapFrogScorer(weight, firstFilterDoc, filterIter, scorer));
                }
            }
Esempio n. 4
0
 public override int NextDoc()
 {
     return(docIdSetIterator.NextDoc());
 }
Esempio n. 5
0
 protected virtual int PrimaryNext()
 {
     return(primary.NextDoc());
 }