示例#1
0
            public override int GetOrd(int docID)
            {
                int subIndex   = ReaderUtil.SubIndex(docID, docStarts);
                int segmentOrd = values[subIndex].GetOrd(docID - docStarts[subIndex]);

                return(segmentOrd == -1 ? segmentOrd : (int)mapping.GetGlobalOrd(subIndex, segmentOrd));
            }
示例#2
0
 /// <summary>
 /// Helper method for subclasses to get the corresponding reader for a doc ID </summary>
 protected internal int ReaderIndex(int docID)
 {
     if (docID < 0 || docID >= maxDoc)
     {
         throw new ArgumentOutOfRangeException(nameof(docID), "docID must be >= 0 and < maxDoc=" + maxDoc + " (got docID=" + docID + ")"); // LUCENENET specific - changed from IllegalArgumentException to ArgumentOutOfRangeException (.NET convention)
     }
     return(ReaderUtil.SubIndex(docID, this.starts));
 }
 /// <summary>
 /// Helper method for subclasses to get the corresponding reader for a doc ID </summary>
 protected internal int ReaderIndex(int docID)
 {
     if (docID < 0 || docID >= maxDoc)
     {
         throw new System.ArgumentException("docID must be >= 0 and < maxDoc=" + maxDoc + " (got docID=" + docID + ")");
     }
     return(ReaderUtil.SubIndex(docID, this.starts));
 }
示例#4
0
        public bool Get(int doc)
        {
            int reader = ReaderUtil.SubIndex(doc, starts);

            Debug.Assert(reader != -1);
            IBits bits = subs[reader];

            if (bits == null)
            {
                return(sefaultValue);
            }
            else
            {
                Debug.Assert(CheckLength(reader, doc));
                return(bits.Get(doc - starts[reader]));
            }
        }
示例#5
0
        /// <summary>
        /// Returns a sub-Bits matching the provided <paramref name="slice"/>
        /// <para/>
        /// Because <c>null</c> usually has a special meaning for
        /// <see cref="IBits"/> (e.g. no deleted documents), you must check
        /// <see cref="SubResult.Matches"/> instead to ensure the sub was
        /// actually found.
        /// </summary>
        public SubResult GetMatchingSub(ReaderSlice slice)
        {
            int reader = ReaderUtil.SubIndex(slice.Start, starts);

            Debug.Assert(reader != -1);
            Debug.Assert(reader < subs.Length, "slice=" + slice + " starts[-1]=" + starts[starts.Length - 1]);
            SubResult subResult = new SubResult();

            if (starts[reader] == slice.Start && starts[1 + reader] == slice.Start + slice.Length)
            {
                subResult.Matches = true;
                subResult.Result  = subs[reader];
            }
            else
            {
                subResult.Matches = false;
            }
            return(subResult);
        }
示例#6
0
 public override void SetDocument(int docID)
 {
     currentSubIndex = ReaderUtil.SubIndex(docID, docStarts);
     values[currentSubIndex].SetDocument(docID - docStarts[currentSubIndex]);
 }
示例#7
0
            public override void Get(int docID, BytesRef result)
            {
                int subIndex = ReaderUtil.SubIndex(docID, starts);

                values[subIndex].Get(docID - starts[subIndex], result);
            }
示例#8
0
            public override long Get(int docID)
            {
                int subIndex = ReaderUtil.SubIndex(docID, starts);

                return(values[subIndex].Get(docID - starts[subIndex]));
            }