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)); }
/// <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)); }
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])); } }
/// <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); }
public override void SetDocument(int docID) { currentSubIndex = ReaderUtil.SubIndex(docID, docStarts); values[currentSubIndex].SetDocument(docID - docStarts[currentSubIndex]); }
public override void Get(int docID, BytesRef result) { int subIndex = ReaderUtil.SubIndex(docID, starts); values[subIndex].Get(docID - starts[subIndex], result); }
public override long Get(int docID) { int subIndex = ReaderUtil.SubIndex(docID, starts); return(values[subIndex].Get(docID - starts[subIndex])); }