Пример #1
0
        public ReadSession(string collectionName,
                           ulong collectionId,
                           SessionFactory sessionFactory,
                           IConfigurationProvider config,
                           IStringModel tokenizer)
            : base(collectionName, collectionId, sessionFactory)
        {
            ValueStream      = sessionFactory.CreateReadStream(Path.Combine(sessionFactory.Dir, string.Format("{0}.val", CollectionId)));
            KeyStream        = sessionFactory.CreateReadStream(Path.Combine(sessionFactory.Dir, string.Format("{0}.key", CollectionId)));
            DocStream        = sessionFactory.CreateReadStream(Path.Combine(sessionFactory.Dir, string.Format("{0}.docs", CollectionId)));
            ValueIndexStream = sessionFactory.CreateReadStream(Path.Combine(sessionFactory.Dir, string.Format("{0}.vix", CollectionId)));
            KeyIndexStream   = sessionFactory.CreateReadStream(Path.Combine(sessionFactory.Dir, string.Format("{0}.kix", CollectionId)));
            DocIndexStream   = sessionFactory.CreateReadStream(Path.Combine(sessionFactory.Dir, string.Format("{0}.dix", CollectionId)));

            _docIx     = new DocIndexReader(DocIndexStream);
            _docs      = new DocMapReader(DocStream);
            _keyIx     = new ValueIndexReader(KeyIndexStream);
            _valIx     = new ValueIndexReader(ValueIndexStream);
            _keyReader = new ValueReader(KeyStream);
            _valReader = new ValueReader(ValueStream);
            _config    = config;
            _tokenizer = tokenizer;

            var posFileName = Path.Combine(SessionFactory.Dir, $"{CollectionId}.pos");

            _postingsStream = SessionFactory.CreateReadStream(posFileName);
        }
Пример #2
0
        public DocumentStreamSession(string collectionName, ulong collectionId, SessionFactory sessionFactory)
            : base(collectionName, collectionId, sessionFactory)
        {
            ValueStream      = sessionFactory.CreateReadStream(Path.Combine(sessionFactory.Dir, string.Format("{0}.val", CollectionId)));
            KeyStream        = sessionFactory.CreateReadStream(Path.Combine(sessionFactory.Dir, string.Format("{0}.key", CollectionId)));
            DocStream        = sessionFactory.CreateReadStream(Path.Combine(sessionFactory.Dir, string.Format("{0}.docs", CollectionId)));
            ValueIndexStream = sessionFactory.CreateReadStream(Path.Combine(sessionFactory.Dir, string.Format("{0}.vix", CollectionId)));
            KeyIndexStream   = sessionFactory.CreateReadStream(Path.Combine(sessionFactory.Dir, string.Format("{0}.kix", CollectionId)));
            DocIndexStream   = sessionFactory.CreateReadStream(Path.Combine(sessionFactory.Dir, string.Format("{0}.dix", CollectionId)));

            _docIx     = new DocIndexReader(DocIndexStream);
            _docs      = new DocMapReader(DocStream);
            _keyIx     = new ValueIndexReader(KeyIndexStream);
            _valIx     = new ValueIndexReader(ValueIndexStream);
            _keyReader = new ValueReader(KeyStream);
            _valReader = new ValueReader(ValueStream);
        }
Пример #3
0
        public BOWReadSession(string collectionName,
                              ulong collectionId,
                              SessionFactory sessionFactory,
                              IConfigurationProvider config)
            : base(collectionName, collectionId, sessionFactory)
        {
            ValueStream      = sessionFactory.CreateAsyncReadStream(Path.Combine(sessionFactory.Dir, string.Format("{0}.val", CollectionId)));
            KeyStream        = sessionFactory.CreateAsyncReadStream(Path.Combine(sessionFactory.Dir, string.Format("{0}.key", CollectionId)));
            DocStream        = sessionFactory.CreateAsyncReadStream(Path.Combine(sessionFactory.Dir, string.Format("{0}.docs", CollectionId)));
            ValueIndexStream = sessionFactory.CreateAsyncReadStream(Path.Combine(sessionFactory.Dir, string.Format("{0}.vix", CollectionId)));
            KeyIndexStream   = sessionFactory.CreateAsyncReadStream(Path.Combine(sessionFactory.Dir, string.Format("{0}.kix", CollectionId)));
            DocIndexStream   = sessionFactory.CreateAsyncReadStream(Path.Combine(sessionFactory.Dir, string.Format("{0}.dix", CollectionId)));

            _docIx          = new DocIndexReader(DocIndexStream);
            _docs           = new DocMapReader(DocStream);
            _keyIx          = new ValueIndexReader(KeyIndexStream);
            _valIx          = new ValueIndexReader(ValueIndexStream);
            _keyReader      = new ValueReader(KeyStream);
            _valReader      = new ValueReader(ValueStream);
            _postingsReader = new RemotePostingsReader(config, collectionName);
            _indexReaders   = new ConcurrentDictionary <long, NodeReader>();
            _config         = config;
        }