Example #1
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));
 }
Example #2
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
//ORIGINAL LINE: public SortingTerms(final org.apache.lucene.index.Terms in, org.apache.lucene.index.FieldInfo.IndexOptions indexOptions, final Sorter.DocMap docMap)
            public SortingTerms(Terms @in, IndexOptions indexOptions, Sorter.DocMap docMap) : base(@in)
            {
                this.docMap       = docMap;
                this.indexOptions = indexOptions;
            }
Example #3
0
        internal readonly Sorter.DocMap docMap;   // pkg-protected to avoid synthetic accessor methods

//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
//ORIGINAL LINE: private SortingAtomicReader(final org.apache.lucene.index.AtomicReader in, final Sorter.DocMap docMap)
        private SortingAtomicReader(AtomicReader @in, Sorter.DocMap docMap) : base(@in)
        {
            this.docMap = docMap;
        }
Example #4
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: SortingDocsAndPositionsEnum(int maxDoc, SortingDocsAndPositionsEnum reuse, final org.apache.lucene.index.DocsAndPositionsEnum in, Sorter.DocMap docMap, boolean storeOffsets) throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
            internal SortingDocsAndPositionsEnum(int maxDoc, SortingDocsAndPositionsEnum reuse, DocsAndPositionsEnum @in, Sorter.DocMap docMap, bool storeOffsets) : base(@in)
            {
                this.maxDoc       = maxDoc;
                this.storeOffsets = storeOffsets;
                if (reuse != null)
                {
                    docs    = reuse.docs;
                    offsets = reuse.offsets;
                    payload = reuse.payload;
                    file    = reuse.file;
                    if (reuse.maxDoc == maxDoc)
                    {
                        sorter = reuse.sorter;
                    }
                    else
                    {
                        sorter = new DocOffsetSorter(maxDoc);
                    }
                }
                else
                {
                    docs    = new int[32];
                    offsets = new long[32];
                    payload = new BytesRef(32);
                    file    = new RAMFile();
                    sorter  = new DocOffsetSorter(maxDoc);
                }
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.apache.lucene.store.IndexOutput out = new org.apache.lucene.store.RAMOutputStream(file);
                IndexOutput @out = new RAMOutputStream(file);
                int         doc;
                int         i = 0;

                while ((doc = @in.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS)
                {
                    if (i == docs.Length)
                    {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final int newLength = org.apache.lucene.util.ArrayUtil.oversize(i + 1, 4);
                        int newLength = ArrayUtil.oversize(i + 1, 4);
                        docs    = Arrays.copyOf(docs, newLength);
                        offsets = Arrays.copyOf(offsets, newLength);
                    }
                    docs[i]    = docMap.oldToNew(doc);
                    offsets[i] = @out.FilePointer;
                    addPositions(@in, @out);
                    i++;
                }
                upto = i;
                sorter.reset(docs, offsets);
                sorter.sort(0, upto);
                @out.close();
                this.postingInput = new RAMInputStream("", file);
            }
Example #5
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: SortingDocsEnum(int maxDoc, SortingDocsEnum reuse, final org.apache.lucene.index.DocsEnum in, boolean withFreqs, final Sorter.DocMap docMap) throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
            internal SortingDocsEnum(int maxDoc, SortingDocsEnum reuse, DocsEnum @in, bool withFreqs, Sorter.DocMap docMap) : base(@in)
            {
                this.maxDoc    = maxDoc;
                this.withFreqs = withFreqs;
                if (reuse != null)
                {
                    if (reuse.maxDoc == maxDoc)
                    {
                        sorter = reuse.sorter;
                    }
                    else
                    {
                        sorter = new DocFreqSorter(maxDoc);
                    }
                    docs  = reuse.docs;
                    freqs = reuse.freqs;     // maybe null
                }
                else
                {
                    docs   = new int[64];
                    sorter = new DocFreqSorter(maxDoc);
                }
                docIt = -1;
                int i = 0;
                int doc;

                if (withFreqs)
                {
                    if (freqs == null || freqs.Length < docs.Length)
                    {
                        freqs = new int[docs.Length];
                    }
                    while ((doc = @in.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS)
                    {
                        if (i >= docs.Length)
                        {
                            docs  = ArrayUtil.grow(docs, docs.Length + 1);
                            freqs = ArrayUtil.grow(freqs, freqs.Length + 1);
                        }
                        docs[i]  = docMap.oldToNew(doc);
                        freqs[i] = @in.freq();
                        ++i;
                    }
                }
                else
                {
                    freqs = null;
                    while ((doc = @in.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS)
                    {
                        if (i >= docs.Length)
                        {
                            docs = ArrayUtil.grow(docs, docs.Length + 1);
                        }
                        docs[i++] = docMap.oldToNew(doc);
                    }
                }
                // TimSort can save much time compared to other sorts in case of
                // reverse sorting, or when sorting a concatenation of sorted readers
                sorter.reset(docs, freqs);
                sorter.sort(0, i);
                upto = i;
            }
Example #6
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
//ORIGINAL LINE: public SortingFields(final org.apache.lucene.index.Fields in, org.apache.lucene.index.FieldInfos infos, Sorter.DocMap docMap)
            public SortingFields(Fields @in, FieldInfos infos, Sorter.DocMap docMap) : base(@in)
            {
                this.docMap = docMap;
                this.infos  = infos;
            }
Example #7
0
 internal SortingSortedSetDocValues(SortedSetDocValues @in, Sorter.DocMap docMap)
 {
     this.@in    = @in;
     this.docMap = docMap;
 }
Example #8
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
//ORIGINAL LINE: public SortingBits(final org.apache.lucene.util.Bits in, Sorter.DocMap docMap)
            public SortingBits(Bits @in, Sorter.DocMap docMap)
            {
                this.@in    = @in;
                this.docMap = docMap;
            }
Example #9
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
//ORIGINAL LINE: public SortingNumericDocValues(final org.apache.lucene.index.NumericDocValues in, Sorter.DocMap docMap)
            public SortingNumericDocValues(NumericDocValues @in, Sorter.DocMap docMap)
            {
                this.@in    = @in;
                this.docMap = docMap;
            }
Example #10
0
 internal SortingBinaryDocValues(BinaryDocValues @in, Sorter.DocMap docMap)
 {
     this.@in    = @in;
     this.docMap = docMap;
 }
Example #11
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
//ORIGINAL LINE: public SortingTermsEnum(final org.apache.lucene.index.TermsEnum in, Sorter.DocMap docMap, org.apache.lucene.index.FieldInfo.IndexOptions indexOptions)
            public SortingTermsEnum(TermsEnum @in, Sorter.DocMap docMap, IndexOptions indexOptions) : base(@in)
            {
                this.docMap       = docMap;
                this.indexOptions = indexOptions;
            }