private CompositeReaderContext(CompositeReaderContext parent, CompositeReader reader, int ordInParent, int docbaseInParent, IList <IndexReaderContext> children, IList <AtomicReaderContext> leaves)
     : base(parent, ordInParent, docbaseInParent)
 {
     this.children = Collections.UnmodifiableList(children);
     this.leaves   = leaves;
     this.reader   = reader;
 }
Beispiel #2
0
 private CompositeReaderContext(CompositeReaderContext parent, CompositeReader reader, int ordInParent, int docbaseInParent, List <IndexReaderContext> children, IList <AtomicReaderContext> leaves)
     : base(parent, ordInParent, docbaseInParent)
 {
     this.children = children.AsReadOnly();
     this.leaves   = leaves;
     this.reader   = reader;
 }
 private CompositeReaderContext(CompositeReaderContext parent, CompositeReader reader, int ordInParent, int docbaseInParent, List<IndexReaderContext> children, IList<AtomicReaderContext> leaves)
     : base(parent, ordInParent, docbaseInParent)
 {
     this.children = children.AsReadOnly();
     this.leaves = leaves;
     this.reader = reader;
 }
Beispiel #4
0
 /// <summary>
 /// Creates a new <see cref="AtomicReaderContext"/>
 /// </summary>
 internal AtomicReaderContext(CompositeReaderContext parent, AtomicReader reader, int ord, int docBase, int leafOrd, int leafDocBase)
     : base(parent, ord, docBase)
 {
     this.Ord     = leafOrd;
     this.DocBase = leafDocBase;
     this.reader  = reader;
     this.leaves  = IsTopLevel ? new[] { this } : null;
 }
 /// <summary>
 /// Creates a new <seealso cref="AtomicReaderContext"/>
 /// </summary>
 internal AtomicReaderContext(CompositeReaderContext parent, AtomicReader reader, int ord, int docBase, int leafOrd, int leafDocBase)
     : base(parent, ord, docBase)
 {
     this.Ord = leafOrd;
     this.DocBase = leafDocBase;
     this.reader = reader;
     this.leaves = IsTopLevel ? new[] { this } : null; //LUCENE TO-DO suspicous
 }
 internal IndexReaderContext(CompositeReaderContext parent, int ordInParent, int docBaseInParent)
 {
     if (!(this is CompositeReaderContext || this is AtomicReaderContext))
     {
         throw new Exception("this class should never be extended by custom code!");
     }
     this.Parent = parent;
     this.DocBaseInParent = docBaseInParent;
     this.OrdInParent = ordInParent;
     this.IsTopLevel = parent == null;
 }
Beispiel #7
0
 internal IndexReaderContext(CompositeReaderContext parent, int ordInParent, int docBaseInParent)
 {
     if (!(this is CompositeReaderContext || this is AtomicReaderContext))
     {
         throw new Exception("this class should never be extended by custom code!");
     }
     this.Parent          = parent;
     this.DocBaseInParent = docBaseInParent;
     this.OrdInParent     = ordInParent;
     this.IsTopLevel      = parent == null;
 }
            internal IndexReaderContext Build(CompositeReaderContext parent, IndexReader reader, int ord, int docBase)
            {
                var ar = reader as AtomicReader;

                if (ar != null)
                {
                    var atomic = new AtomicReaderContext(parent, ar, ord, docBase, leaves.Count, leafDocBase);
                    leaves.Add(atomic);
                    leafDocBase += reader.MaxDoc;
                    return(atomic);
                }
                else
                {
                    CompositeReader        cr = (CompositeReader)reader;
                    var                    sequentialSubReaders = cr.GetSequentialSubReaders();
                    var                    children             = new IndexReaderContext[sequentialSubReaders.Count];
                    CompositeReaderContext newParent;
                    if (parent == null)
                    {
                        newParent = new CompositeReaderContext(cr, children, leaves);
                    }
                    else
                    {
                        newParent = new CompositeReaderContext(parent, cr, ord, docBase, children);
                    }
                    int newDocBase = 0;
                    for (int i = 0, c = sequentialSubReaders.Count; i < c; i++)
                    {
                        IndexReader r = sequentialSubReaders[i];
                        children[i] = Build(newParent, r, i, newDocBase);
                        newDocBase += r.MaxDoc;
                    }
                    if (Debugging.AssertsEnabled)
                    {
                        Debugging.Assert(newDocBase == cr.MaxDoc);
                    }
                    return(newParent);
                }
            }
Beispiel #9
0
 /// <summary>
 /// Creates a <seealso cref="CompositeReaderContext"/> for intermediate readers that aren't
 /// not top-level readers in the current context
 /// </summary>
 internal CompositeReaderContext(CompositeReaderContext parent, CompositeReader reader, int ordInParent, int docbaseInParent, List <IndexReaderContext> children)
     : this(parent, reader, ordInParent, docbaseInParent, children, null)
 {
 }
 /// <summary>
 /// Creates a <seealso cref="CompositeReaderContext"/> for intermediate readers that aren't
 /// not top-level readers in the current context
 /// </summary>
 internal CompositeReaderContext(CompositeReaderContext parent, CompositeReader reader, int ordInParent, int docbaseInParent, List<IndexReaderContext> children)
     : this(parent, reader, ordInParent, docbaseInParent, children, null)
 {
 }
 internal IndexReaderContext Build(CompositeReaderContext parent, IndexReader reader, int ord, int docBase)
 {
     var ar = reader as AtomicReader;
     if (ar != null)
     {
         var atomic = new AtomicReaderContext(parent, ar, ord, docBase, Leaves.Count, LeafDocBase);
         Leaves.Add(atomic);
         LeafDocBase += reader.MaxDoc;
         return atomic;
     }
     else
     {
         CompositeReader cr = (CompositeReader)reader;
         var sequentialSubReaders = cr.GetSequentialSubReaders();
         var children = Arrays.AsList(new IndexReaderContext[sequentialSubReaders.Count]);
         CompositeReaderContext newParent;
         if (parent == null)
         {
             newParent = new CompositeReaderContext(cr, children, Leaves);
         }
         else
         {
             newParent = new CompositeReaderContext(parent, cr, ord, docBase, children);
         }
         int newDocBase = 0;
         for (int i = 0, c = sequentialSubReaders.Count; i < c; i++)
         {
             IndexReader r = sequentialSubReaders[i];
             children[i] = Build(newParent, r, i, newDocBase);
             newDocBase += r.MaxDoc;
         }
         Debug.Assert(newDocBase == cr.MaxDoc);
         return newParent;
     }
 }