protected internal override object DoBody(System.String segmentFileName)
            {
                SegmentInfos infos = new SegmentInfos();

                infos.Read(directory, segmentFileName);

                DirectoryIndexReader reader;

                if (infos.Count == 1)
                {
                    // index is optimized
                    reader = SegmentReader.Get(readOnly, infos, infos.Info(0), closeDirectory);
                }
                else if (readOnly)
                {
                    reader = new ReadOnlyMultiSegmentReader(directory, infos, closeDirectory);
                }
                else
                {
                    reader = new MultiSegmentReader(directory, infos, closeDirectory, false);
                }
                reader.SetDeletionPolicy(deletionPolicy);

                return(reader);
            }
            protected internal override object DoBody(System.String segmentFileName)
            {
                SegmentInfos infos = new SegmentInfos();
                infos.Read(directory, segmentFileName);

                DirectoryIndexReader reader;
                if (infos.Count == 1)
                {
                    // index is optimized
                    reader = SegmentReader.Get(readOnly, infos, infos.Info(0), closeDirectory);
                }
                else if (readOnly)
                {
                    reader = new ReadOnlyMultiSegmentReader(directory, infos, closeDirectory);
                }
                else
                {
                    reader = new MultiSegmentReader(directory, infos, closeDirectory, false);
                }
                reader.SetDeletionPolicy(deletionPolicy);

                return reader;
            }