Ejemplo n.º 1
0
        private IEnumerable <Document> StreamDocuments()
        {
            var skipped = 0;
            var took    = 0;

            for (int docId = 0; docId < _ix.DocumentCount; docId++)
            {
                var hash = _hashReader.Read(docId);

                var address = _addressReader.Read(new[]
                {
                    new BlockInfo(docId * BlockSerializer.SizeOfBlock(), BlockSerializer.SizeOfBlock())
                }).First();

                var document = _documentReader.Read(new List <BlockInfo> {
                    address
                }).First();

                if (!hash.IsObsolete)
                {
                    if (skipped == _skip && took < _take)
                    {
                        yield return(document);

                        took++;
                    }
                    else if (skipped < _skip)
                    {
                        skipped++;
                    }
                    else if (took == _take)
                    {
                        break;
                    }
                }
            }
        }
Ejemplo n.º 2
0
 public DocHash ReadDocHash(int docId)
 {
     return(_docHashReader.Read(docId));
 }