示例#1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: @Override public org.apache.lucene.index.DocsEnum docs(org.apache.lucene.util.Bits liveDocs, org.apache.lucene.index.DocsEnum reuse, final int flags) throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
            public override DocsEnum docs(Bits liveDocs, DocsEnum reuse, int flags)
            {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.apache.lucene.index.DocsEnum inReuse;
                DocsEnum inReuse;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final SortingDocsEnum wrapReuse;
                SortingDocsEnum wrapReuse;

                if (reuse != null && reuse is SortingDocsEnum)
                {
                    // if we're asked to reuse the given DocsEnum and it is Sorting, return
                    // the wrapped one, since some Codecs expect it.
                    wrapReuse = (SortingDocsEnum)reuse;
                    inReuse   = wrapReuse.Wrapped;
                }
                else
                {
                    wrapReuse = null;
                    inReuse   = reuse;
                }

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.apache.lucene.index.DocsEnum inDocs = in.docs(newToOld(liveDocs), inReuse, flags);
                DocsEnum inDocs = @in.docs(newToOld(liveDocs), inReuse, flags);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final boolean withFreqs = indexOptions.compareTo(org.apache.lucene.index.FieldInfo.IndexOptions.DOCS_AND_FREQS) >=0 && (flags & org.apache.lucene.index.DocsEnum.FLAG_FREQS) != 0;
                bool withFreqs = indexOptions.compareTo(IndexOptions.DOCS_AND_FREQS) >= 0 && (flags & DocsEnum.FLAG_FREQS) != 0;

                return(new SortingDocsEnum(docMap.size(), wrapReuse, inDocs, withFreqs, docMap));
            }
示例#2
0
 /// <summary>
 /// Expert: same as <seealso cref="#wrap(AtomicReader, Sort)"/> but operates directly on a <seealso cref="Sorter.DocMap"/>. </summary>
 internal static AtomicReader wrap(AtomicReader reader, Sorter.DocMap docMap)
 {
     if (docMap == null)
     {
         // the reader is already sorter
         return(reader);
     }
     if (reader.maxDoc() != docMap.size())
     {
         throw new System.ArgumentException("reader.maxDoc() should be equal to docMap.size(), got" + reader.maxDoc() + " != " + docMap.size());
     }
     Debug.Assert(Sorter.isConsistent(docMap));
     return(new SortingAtomicReader(reader, docMap));
 }