public void PerformWork(PurgeAllLuceneWork work, IDirectoryProvider provider)
        {
            System.Type entity = work.EntityClass;
            if (log.IsDebugEnabled)
                log.Debug("PurgeAll Lucene index: " + entity);

            IndexReader reader = workspace.GetIndexReader(provider, entity);
            try
            {
                Term term = new Term(DocumentBuilder.CLASS_FIELDNAME, TypeHelper.LuceneTypeName(entity));
                reader.DeleteDocuments(term);
            }
            catch (Exception e)
            {
                throw new SearchException("Unable to purge all from Lucene index: " + entity, e);
            }
        }
        public void PerformWork(PurgeAllLuceneWork work, IDirectoryProvider provider)
        {
            System.Type entity = work.EntityClass;
            if (log.IsDebugEnabled)
            {
                log.Debug("PurgeAll Lucene index: " + entity);
            }

            IndexReader reader = workspace.GetIndexReader(provider, entity);

            try
            {
                Term term = new Term(DocumentBuilder.CLASS_FIELDNAME, TypeHelper.LuceneTypeName(entity));
                reader.DeleteDocuments(term);
            }
            catch (Exception e)
            {
                throw new SearchException("Unable to purge all from Lucene index: " + entity, e);
            }
        }
Example #3
0
        public void PerformWork(PurgeAllLuceneWork work, IDirectoryProvider provider)
        {
            var entity = work.EntityClass;

            if (log.IsDebugEnabled)
            {
                log.Debug("PurgeAll Lucene index: " + entity);
            }

            var writer = _workspace.GetIndexWriter(provider, entity, true);

            try
            {
                writer.DeleteAll();
            }
            catch (Exception e)
            {
                throw new SearchException("Unable to purge all from Lucene index: " + entity, e);
            }
        }