示例#1
0
        internal virtual void  TstIterator(SortedVIntList vintList, int[] ints)
        {
            for (int i = 0; i < ints.Length; i++)
            {
                if ((i > 0) && (ints[i - 1] == ints[i]))
                {
                    return;                      // DocNrSkipper should not skip to same document.
                }
            }
            DocIdSetIterator m = vintList.Iterator();

            for (int i = 0; i < ints.Length; i++)
            {
                Assert.IsTrue(m.NextDoc() != DocIdSetIterator.NO_MORE_DOCS, "No end of Matcher at: " + i);
                Assert.AreEqual(ints[i], m.DocID());
            }
            Assert.IsTrue(m.NextDoc() == DocIdSetIterator.NO_MORE_DOCS, "End of Matcher");
        }
示例#2
0
 /// <summary>
 /// Perform an inplace NOT with the doc ids from a given DocIdSetIterator,
 /// clearing all the bits for each such doc id.
 /// These doc ids should be smaller than the maximum size passed to the
 /// constructor.
 /// </summary>
 public virtual void InPlaceNot(DocIdSetIterator disi)
 {
     int doc;
     long size = Size();
     while ((doc = disi.NextDoc()) < size)
     {
         FastClear(doc);
     }
 }
示例#3
0
        /// <summary> Perform an inplace NOT with the doc ids from a given DocIdSetIterator,
        /// clearing all the bits for each such doc id.
        /// These doc ids should be smaller than the maximum size passed to the
        /// constructor.
        /// </summary>
        public virtual void  InPlaceNot(DocIdSetIterator disi, IState state)
        {
            int  doc;
            long size = Size();

            while ((doc = disi.NextDoc(state)) < size)
            {
                FastClear(doc);
            }
        }
示例#4
0
        /// <summary>
        /// Perform an inplace NOT with the doc ids from a given <see cref="DocIdSetIterator"/>,
        /// clearing all the bits for each such doc id.
        /// These doc ids should be smaller than the maximum size passed to the
        /// constructor.
        /// </summary>
        public virtual void InPlaceNot(DocIdSetIterator disi)
        {
            int  doc;
            long size = Length; // LUCENENET specific - using Length in place of Size (since they are the same)

            while ((doc = disi.NextDoc()) < size)
            {
                FastClear(doc);
            }
        }
示例#5
0
        /// <summary> Perform an inplace OR with the doc ids from a given DocIdSetIterator,
        /// setting the bit for each such doc id.
        /// These doc ids should be smaller than the maximum size passed to the
        /// constructor.
        /// </summary>
        public virtual void  InPlaceOr(DocIdSetIterator disi)
        {
            int  doc;
            long size = Size();

            while ((doc = disi.NextDoc()) < size)
            {
                FastSet(doc);
            }
        }
        /// <summary> Create a SortedVIntList.</summary>
        /// <param name="docIdSetIterator"> An iterator providing document numbers as a set of integers.
        /// This DocIdSetIterator is iterated completely when this constructor
        /// is called and it must provide the integers in non
        /// decreasing order.
        /// </param>
        public SortedVIntList(DocIdSetIterator docIdSetIterator)
        {
            SortedVIntListBuilder builder = new SortedVIntListBuilder(this);
            int doc;

            while ((doc = docIdSetIterator.NextDoc()) != DocIdSetIterator.NO_MORE_DOCS)
            {
                builder.AddInt(doc);
            }
            builder.Done();
        }
示例#7
0
 /// <summary>
 /// Encode the document ids from a DocIdSetIterator. </summary>
 ///  <param name="disi"> this DocIdSetIterator should provide document ids that are consistent
 ///              with <code>numValues</code> and <code>upperBound</code> as provided to the constructor.   </param>
 public virtual void EncodeFromDisi(DocIdSetIterator disi)
 {
     while (EfEncoder.NumEncoded < EfEncoder.NumValues)
     {
         int x = disi.NextDoc();
         if (x == DocIdSetIterator.NO_MORE_DOCS)
         {
             throw new System.ArgumentException("disi: " + disi.ToString() + "\nhas " + EfEncoder.NumEncoded + " docs, but at least " + EfEncoder.NumValues + " are required.");
         }
         EfEncoder.EncodeNext(x);
     }
 }
示例#8
0
 /// <summary>
 /// Encode the document ids from a DocIdSetIterator. </summary>
 ///  <param name="disi"> this DocIdSetIterator should provide document ids that are consistent
 ///              with <code>numValues</code> and <code>upperBound</code> as provided to the constructor.   </param>
 public virtual void EncodeFromDisi(DocIdSetIterator disi)
 {
     while (EfEncoder.NumEncoded < EfEncoder.NumValues)
     {
         int x = disi.NextDoc();
         if (x == DocIdSetIterator.NO_MORE_DOCS)
         {
             throw new System.ArgumentException("disi: " + disi.ToString() + "\nhas " + EfEncoder.NumEncoded + " docs, but at least " + EfEncoder.NumValues + " are required.");
         }
         EfEncoder.EncodeNext(x);
     }
 }
示例#9
0
                public override int NextDoc()
                {
                    int scorerDoc, disiDoc;

                    return(doc = (disiDoc = docIdSetIterator.NextDoc()) != NO_MORE_DOCS && (scorerDoc = scorer.NextDoc()) != NO_MORE_DOCS && AdvanceToCommon(scorerDoc, disiDoc) != NO_MORE_DOCS?scorer.DocID() : NO_MORE_DOCS);
                }
		/// <summary> Create a SortedVIntList.</summary>
		/// <param name="docIdSetIterator"> An iterator providing document numbers as a set of integers.
		/// This DocIdSetIterator is iterated completely when this constructor
		/// is called and it must provide the integers in non
		/// decreasing order.
		/// </param>
		public SortedVIntList(DocIdSetIterator docIdSetIterator)
		{
			SortedVIntListBuilder builder = new SortedVIntListBuilder(this);
			int doc;
			while ((doc = docIdSetIterator.NextDoc()) != DocIdSetIterator.NO_MORE_DOCS)
			{
				builder.AddInt(doc);
			}
			builder.Done();
		}