Lucene.Net.Index.IndexReader.GetSequentialSubReaders C# (CSharp) Method

GetSequentialSubReaders() public method

Expert: returns the sequential sub readers that this reader is logically composed of. For example, IndexSearcher uses this API to drive searching by one sub reader at a time. If this reader is not composed of sequential child readers, it should return null. If this method returns an empty array, that means this reader is a null reader (for example a MultiReader that has no sub readers).

NOTE: You should not try using sub-readers returned by this method to make any changes (setNorm, deleteDocument, etc.). While this might succeed for one composite reader (like MultiReader), it will most likely lead to index corruption for other readers (like DirectoryReader obtained through IndexReader.Open(Lucene.Net.Store.Directory,bool). Use the parent reader directly.

public GetSequentialSubReaders ( ) : Lucene.Net.Index.IndexReader[]
return Lucene.Net.Index.IndexReader[]
	    public virtual IndexReader[] GetSequentialSubReaders()
	    {
	        return null;
	    }

Usage Example

        public static IDictionary<string, Filter> CreateFilters(IndexReader reader, IDictionary<string, HashSet<string>> feeds)
        {
            var bitSetLookup = new Dictionary<string, IDictionary<string, OpenBitSet>>(StringComparer.OrdinalIgnoreCase);

            foreach (var key in feeds.Keys)
            {
                bitSetLookup[key] = new Dictionary<string, OpenBitSet>();

                foreach (SegmentReader segmentReader in reader.GetSequentialSubReaders())
                {
                    bitSetLookup[key][segmentReader.SegmentName] = new OpenBitSet();
                }
            }

            foreach (SegmentReader segmentReader in reader.GetSequentialSubReaders())
            {
                CreateOpenBitSets(segmentReader, feeds, bitSetLookup);
            }

            var filters = new Dictionary<string, Filter>(StringComparer.OrdinalIgnoreCase);

            foreach (var key in feeds.Keys)
            {
                filters[key] = new OpenBitSetLookupFilter(bitSetLookup[key]);
            }

            return filters;
        }
All Usage Examples Of Lucene.Net.Index.IndexReader::GetSequentialSubReaders