Exemplo n.º 1
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);
            }
Exemplo n.º 2
0
 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);
     }
     using (IndexOutput @out = new RAMOutputStream(file))
     {
         int doc;
         int i = 0;
         while ((doc = @in.NextDoc()) != DocIdSetIterator.NO_MORE_DOCS)
         {
             if (i == docs.Length)
             {
                 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.Position; // LUCENENET specific: Renamed from getFilePointer() to match FileStream
             AddPositions(@in, @out);
             i++;
         }
         upto = i;
         sorter.Reset(docs, offsets);
         sorter.Sort(0, upto);
     }
     this.postingInput = new RAMInputStream("", file);
 }
Exemplo n.º 3
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);
 }
 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);
     }
     using (IndexOutput @out = new RAMOutputStream(file))
     {
         int doc;
         int i = 0;
         while ((doc = @in.NextDoc()) != DocIdSetIterator.NO_MORE_DOCS)
         {
             if (i == docs.Length)
             {
                 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);
     }
     this.postingInput = new RAMInputStream("", file);
 }