/// <summary> Returns sub-reader subIndex from reader. /// /// </summary> /// <param name="reader">parent reader /// </param> /// <param name="subIndex">index of desired sub reader /// </param> /// <returns> the subreader at subINdex /// </returns> public static IndexReader SubReader(IndexReader reader, int subIndex) { System.Collections.ArrayList subReadersList = new System.Collections.ArrayList(); ReaderUtil.GatherSubReaders(subReadersList, reader); IndexReader[] subReaders = (IndexReader[])subReadersList.ToArray(typeof(IndexReader)); return(subReaders[subIndex]); }
/// <summary> Returns sub-reader subIndex from reader. /// /// </summary> /// <param name="reader">parent reader /// </param> /// <param name="subIndex">index of desired sub reader /// </param> /// <returns> the subreader at subINdex /// </returns> public static IndexReader SubReader(IndexReader reader, int subIndex) { var subReadersList = new System.Collections.Generic.List <IndexReader>(); ReaderUtil.GatherSubReaders(subReadersList, reader); IndexReader[] subReaders = subReadersList.ToArray(); return(subReaders[subIndex]); }
/// <summary> Returns sub-reader subIndex from reader. /// /// </summary> /// <param name="reader">parent reader /// </param> /// <param name="subIndex">index of desired sub reader /// </param> /// <returns> the subreader at subINdex /// </returns> public static IndexReader SubReader(IndexReader reader, int subIndex) { List <IndexReader> subReadersList = new List <IndexReader>(); ReaderUtil.GatherSubReaders(subReadersList, reader); IndexReader[] subReaders = subReadersList.ToArray(); return(subReaders[subIndex]); }
/// <summary> Returns sub IndexReader that contains the given document id. /// /// </summary> /// <param name="doc">id of document /// </param> /// <param name="reader">parent reader /// </param> /// <returns> sub reader of parent which contains the specified doc id /// </returns> public static IndexReader SubReader(int doc, IndexReader reader) { System.Collections.ArrayList subReadersList = new System.Collections.ArrayList(); ReaderUtil.GatherSubReaders(subReadersList, reader); IndexReader[] subReaders = (IndexReader[])subReadersList.ToArray(typeof(IndexReader)); int[] docStarts = new int[subReaders.Length]; int maxDoc = 0; for (int i = 0; i < subReaders.Length; i++) { docStarts[i] = maxDoc; maxDoc += subReaders[i].MaxDoc(); } return(subReaders[ReaderUtil.SubIndex(doc, docStarts)]); }
/// <summary> Returns sub IndexReader that contains the given document id. /// /// </summary> /// <param name="doc">id of document /// </param> /// <param name="reader">parent reader /// </param> /// <returns> sub reader of parent which contains the specified doc id /// </returns> public static IndexReader SubReader(int doc, IndexReader reader) { var subReadersList = new System.Collections.Generic.List <IndexReader>(); ReaderUtil.GatherSubReaders(subReadersList, reader); IndexReader[] subReaders = subReadersList.ToArray(); int[] docStarts = new int[subReaders.Length]; int maxDoc = 0; for (int i = 0; i < subReaders.Length; i++) { docStarts[i] = maxDoc; maxDoc += subReaders[i].MaxDoc; } return(subReaders[ReaderUtil.SubIndex(doc, docStarts)]); }