Esempio n. 1
0
        public LuceneIndexModifier(LuceneSettings settings)
        {
            this.settings = settings;

            this.indexBaseDirectory = settings.GetIndexDirectory();
            this.Init();

            StartIndexerThread();
        }
Esempio n. 2
0
        /// <summary>
        /// Deletes the whole index, then creates a new one
        /// without any documents.
        /// </summary>
        public virtual void ResetIndex()
        {
            lock (OpenLock) {
                this.Close();
                if (this.BaseDirectory is RAMDirectory)
                {
                    // nothing to do...?
                }
                else if (this.BaseDirectory is FSDirectory &&
                         settings.IndexPath != null)
                {
                    Directory.Delete(settings.IndexPath, true);
                    Directory.CreateDirectory(settings.IndexPath);
                }
                else
                {
                    Debug.Assert(false, "Unhandled BaseDirectory type: " + this.BaseDirectory.GetType().FullName);
                }
            }//lock

            //this is outside the lock() to avoid deadlock
            this.BaseDirectory = settings.GetIndexDirectory(true);
            this.Init();
        }