//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public DocumentFilteredAtomicIndexReader(AtomicReaderContext context, org.apache.lucene.search.Filter preserveFilter, boolean negateFilter) throws java.io.IOException
            public DocumentFilteredAtomicIndexReader(AtomicReaderContext context, Filter preserveFilter, bool negateFilter) : base(context.reader())
            {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final int maxDoc = in.maxDoc();
                int maxDoc = @in.maxDoc();
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.apache.lucene.util.FixedBitSet bits = new org.apache.lucene.util.FixedBitSet(maxDoc);
                FixedBitSet bits = new FixedBitSet(maxDoc);
                // ignore livedocs here, as we filter them later:
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.apache.lucene.search.DocIdSet docs = preserveFilter.getDocIdSet(context, null);
                DocIdSet docs = preserveFilter.getDocIdSet(context, null);

                if (docs != null)
                {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.apache.lucene.search.DocIdSetIterator it = docs.iterator();
                    DocIdSetIterator it = docs.GetEnumerator();
                    if (it != null)
                    {
                        bits.or(it);
                    }
                }
                if (negateFilter)
                {
                    bits.flip(0, maxDoc);
                }

                if (@in.hasDeletions())
                {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.apache.lucene.util.Bits oldLiveDocs = in.getLiveDocs();
                    Bits oldLiveDocs = @in.LiveDocs;
                    Debug.Assert(oldLiveDocs != null);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.apache.lucene.search.DocIdSetIterator it = bits.iterator();
                    DocIdSetIterator it = bits.GetEnumerator();
                    for (int i = it.nextDoc(); i < maxDoc; i = it.nextDoc())
                    {
                        if (!oldLiveDocs.get(i))
                        {
                            // we can safely modify the current bit, as the iterator already stepped over it:
                            bits.clear(i);
                        }
                    }
                }

                this.liveDocs        = bits;
                this.numDocs_Renamed = bits.cardinality();
            }
Example #2
0
 public override int numDocs()
 {
     return(liveDocs.cardinality());
 }
Example #3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public DocumentFilteredAtomicIndexReader(AtomicReaderContext context, org.apache.lucene.search.Filter preserveFilter, boolean negateFilter) throws java.io.IOException
		public DocumentFilteredAtomicIndexReader(AtomicReaderContext context, Filter preserveFilter, bool negateFilter) : base(context.reader())
		{
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final int maxDoc = in.maxDoc();
		  int maxDoc = @in.maxDoc();
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.apache.lucene.util.FixedBitSet bits = new org.apache.lucene.util.FixedBitSet(maxDoc);
		  FixedBitSet bits = new FixedBitSet(maxDoc);
		  // ignore livedocs here, as we filter them later:
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.apache.lucene.search.DocIdSet docs = preserveFilter.getDocIdSet(context, null);
		  DocIdSet docs = preserveFilter.getDocIdSet(context, null);
		  if (docs != null)
		  {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.apache.lucene.search.DocIdSetIterator it = docs.iterator();
			DocIdSetIterator it = docs.GetEnumerator();
			if (it != null)
			{
			  bits.or(it);
			}
		  }
		  if (negateFilter)
		  {
			bits.flip(0, maxDoc);
		  }

		  if (@in.hasDeletions())
		  {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.apache.lucene.util.Bits oldLiveDocs = in.getLiveDocs();
			Bits oldLiveDocs = @in.LiveDocs;
			Debug.Assert(oldLiveDocs != null);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.apache.lucene.search.DocIdSetIterator it = bits.iterator();
			DocIdSetIterator it = bits.GetEnumerator();
			for (int i = it.nextDoc(); i < maxDoc; i = it.nextDoc())
			{
			  if (!oldLiveDocs.get(i))
			  {
				// we can safely modify the current bit, as the iterator already stepped over it:
				bits.clear(i);
			  }
			}
		  }

		  this.liveDocs = bits;
		  this.numDocs_Renamed = bits.cardinality();
		}