Example #1
0
        public WriteSession(
            string collectionName,
            ulong collectionId,
            SessionFactory sessionFactory,
            TermIndexSession indexSession,
            IConfigurationProvider config) : base(collectionName, collectionId, sessionFactory)
        {
            ValueStream      = sessionFactory.CreateAppendStream(Path.Combine(sessionFactory.Dir, string.Format("{0}.val", CollectionId)), int.Parse(config.Get("value_stream_buffer_size")));
            KeyStream        = sessionFactory.CreateAppendStream(Path.Combine(sessionFactory.Dir, string.Format("{0}.key", CollectionId)));
            DocStream        = sessionFactory.CreateAppendStream(Path.Combine(sessionFactory.Dir, string.Format("{0}.docs", CollectionId)), int.Parse(config.Get("doc_map_stream_buffer_size")));
            ValueIndexStream = sessionFactory.CreateAppendStream(Path.Combine(sessionFactory.Dir, string.Format("{0}.vix", CollectionId)));
            KeyIndexStream   = sessionFactory.CreateAppendStream(Path.Combine(sessionFactory.Dir, string.Format("{0}.kix", CollectionId)));
            DocIndexStream   = sessionFactory.CreateAppendStream(Path.Combine(sessionFactory.Dir, string.Format("{0}.dix", CollectionId)));

            _config       = config;
            _vals         = new ValueWriter(ValueStream);
            _keys         = new ValueWriter(KeyStream);
            _docs         = new DocMapWriter(DocStream);
            _valIx        = new ValueIndexWriter(ValueIndexStream);
            _keyIx        = new ValueIndexWriter(KeyIndexStream);
            _docIx        = new DocIndexWriter(DocIndexStream);
            _indexSession = indexSession;
        }
Example #2
0
        /// <summary>
        /// Fields prefixed with "___" will not be stored.
        /// </summary>
        /// <returns>Document ID</returns>
        public void Write(IDictionary document, TermIndexSession indexSession)
        {
            var docId = Write(document);

            indexSession.Put(docId, document);
        }