コード例 #1
0
        /*======================================================================================================= IIndexPopulator Members */

        // caller: IndexPopulator.Populator, Import.Importer, Tests
        public void ClearAndPopulateAll(TextWriter consoleWriter = null)
        {
            using (var op = SnTrace.Index.StartOperation("IndexPopulator ClearAndPopulateAll"))
            {
                // recreate
                consoleWriter?.Write("  Cleanup index ... ");
                IndexManager.ClearIndex();
                consoleWriter?.WriteLine("ok");

                IndexManager.AddDocuments(
                    SearchManager.LoadIndexDocumentsByPath("/Root", IndexManager.GetNotIndexedNodeTypes())
                    .Select(d =>
                {
                    var indexDoc = IndexManager.CompleteIndexDocument(d);
                    OnNodeIndexed(d.Path);
                    return(indexDoc);
                }));

                consoleWriter?.Write("  Commiting ... ");
                IndexManager.Commit(); // explicit commit
                consoleWriter?.WriteLine("ok");

                consoleWriter?.Write("  Deleting indexing activities ... ");
                IndexManager.DeleteAllIndexingActivities();
                op.Successful = true;
            }
        }
コード例 #2
0
        /*======================================================================================================= IIndexPopulator Members */

        // caller: IndexPopulator.Populator, Import.Importer, Tests
        public void ClearAndPopulateAll(TextWriter consoleWriter = null)
        {
            using (var op = SnTrace.Index.StartOperation("IndexPopulator ClearAndPopulateAll"))
            {
                // recreate
                consoleWriter?.Write("  Cleanup index ... ");
                IndexManager.ClearIndex();
                consoleWriter?.WriteLine("ok");

                IndexManager.AddDocuments(LoadIndexDocumentsByPath("/Root"));

                // delete progress characters
                consoleWriter?.Write("                                             \n");
                consoleWriter?.Write("  Commiting ... ");
                IndexManager.Commit(); // explicit commit
                consoleWriter?.WriteLine("ok");

                consoleWriter?.Write("  Deleting indexing activities ... ");
                IndexManager.DeleteAllIndexingActivities();
                op.Successful = true;
            }
        }