Ejemplo n.º 1
0
        public ReadSession(string collectionId,
                           SessionFactory sessionFactory,
                           IConfigurationService config)
            : base(collectionId, sessionFactory)
        {
            var collection = collectionId.ToHash();

            ValueStream      = sessionFactory.CreateReadWriteStream(Path.Combine(sessionFactory.Dir, string.Format("{0}.val", collection)));
            KeyStream        = sessionFactory.CreateReadWriteStream(Path.Combine(sessionFactory.Dir, string.Format("{0}.key", collection)));
            DocStream        = sessionFactory.CreateReadWriteStream(Path.Combine(sessionFactory.Dir, string.Format("{0}.docs", collection)));
            ValueIndexStream = sessionFactory.CreateReadWriteStream(Path.Combine(sessionFactory.Dir, string.Format("{0}.vix", collection)));
            KeyIndexStream   = sessionFactory.CreateReadWriteStream(Path.Combine(sessionFactory.Dir, string.Format("{0}.kix", collection)));
            DocIndexStream   = sessionFactory.CreateReadWriteStream(Path.Combine(sessionFactory.Dir, string.Format("{0}.dix", collection)));
            Index            = sessionFactory.GetCollectionIndex(collectionId.ToHash()) ?? new SortedList <long, VectorNode>();

            _docIx          = new DocIndexReader(DocIndexStream);
            _docs           = new DocReader(DocStream);
            _keyIx          = new ValueIndexReader(KeyIndexStream);
            _valIx          = new ValueIndexReader(ValueIndexStream);
            _keyReader      = new ValueReader(KeyStream);
            _valReader      = new ValueReader(ValueStream);
            _postingsReader = new RemotePostingsReader(config);

            _log = Logging.CreateWriter("readsession");
        }
Ejemplo n.º 2
0
        public IndexingSession(
            string collectionId,
            SessionFactory sessionFactory,
            ITokenizer tokenizer,
            IConfigurationService config) : base(collectionId, sessionFactory)
        {
            _tokenizer      = tokenizer;
            _log            = Logging.CreateWriter("indexingsession");
            _dirty          = new ConcurrentDictionary <long, VectorNode>();
            _postingsWriter = new RemotePostingsWriter(config);
            _timer          = new Stopwatch();
            _validate       = config.Get("create_index_validation_files") == "true";

            Index = sessionFactory.GetCollectionIndex(collectionId.ToHash()) ?? new SortedList <long, VectorNode>();
        }