예제 #1
0
 public void RegisterTransactWriter(string key, TransactIndexWriter wr)
 {
     if (IsInTransaction)
     {
         Writers[key]   = wr;
         wr.Transaction = this;
     }
 }
예제 #2
0
        public IndexWriter CreateWriter()
        {
            var storeDirectoryKey = String.Format("{0}#{1}", StoreDirectory.GetHashCode(), StoreDirectory.ToString());

            if (Transaction != null && Transaction.IsInTransaction && Transaction.GetTransactWriter(storeDirectoryKey) != null)
            {
                return(Transaction.GetTransactWriter(storeDirectoryKey));
            }

            var indexExists = IndexReader.IndexExists(StoreDirectory);
            var indexWriter = new TransactIndexWriter(StoreDirectory, Analyzer, !indexExists, IndexWriter.MaxFieldLength.UNLIMITED);

            indexWriter.SetUseCompoundFile(UseCompoundFile);

            if (Transaction != null)
            {
                Transaction.RegisterTransactWriter(storeDirectoryKey, indexWriter);
            }

            return(indexWriter);
        }
예제 #3
0
        public IndexWriter CreateWriter()
        {
            var indexDir = ResolveLocalIndexPath();

            if (Transaction != null && Transaction.IsInTransaction && Transaction.GetTransactWriter(indexDir) != null)
            {
                return(Transaction.GetTransactWriter(indexDir));
            }



            var indexExists = IndexReader.IndexExists(indexDir);
            var indexWriter = new TransactIndexWriter(ResolveLocalIndexPath(), Analyzer, !indexExists, IndexWriter.MaxFieldLength.UNLIMITED);

            indexWriter.SetUseCompoundFile(UseCompoundFile);

            if (Transaction != null)
            {
                Transaction.RegisterTransactWriter(indexDir, indexWriter);
            }

            return(indexWriter);
        }
예제 #4
0
        public IndexWriter CreateWriter()
        {
            var storeDirectoryKey = String.Format("{0}#{1}", StoreDirectory.GetHashCode(), StoreDirectory.ToString() );

            if (Transaction != null && Transaction.IsInTransaction && Transaction.GetTransactWriter(storeDirectoryKey) != null)
                return Transaction.GetTransactWriter(storeDirectoryKey);

            var indexExists = IndexReader.IndexExists(StoreDirectory);
            var indexWriter = new TransactIndexWriter(StoreDirectory, Analyzer, !indexExists, IndexWriter.MaxFieldLength.UNLIMITED);
            indexWriter.SetUseCompoundFile(UseCompoundFile);

            if (Transaction != null) {
                Transaction.RegisterTransactWriter(storeDirectoryKey, indexWriter);
            }

            return indexWriter;
        }
예제 #5
0
        public IndexWriter CreateWriter()
        {
            var indexDir = ResolveLocalIndexPath();
            if (Transaction != null && Transaction.IsInTransaction && Transaction.GetTransactWriter(indexDir)!=null)
                return Transaction.GetTransactWriter(indexDir);

            var indexExists = IndexReader.IndexExists(indexDir);
            var indexWriter = new TransactIndexWriter(ResolveLocalIndexPath(), Analyzer, !indexExists, IndexWriter.MaxFieldLength.UNLIMITED);
            indexWriter.SetUseCompoundFile(UseCompoundFile);

            if (Transaction != null) {
                Transaction.RegisterTransactWriter(indexDir, indexWriter);
            }

            return indexWriter;
        }