Esempio n. 1
0
 /// <summary>
 /// Reindex all OpenContent modules of all portals.
 /// </summary>
 internal void IndexAll()
 {
     Log.Logger.Info("Reindexing all OpenContent data, from all portals");
     LuceneController.ClearInstance();
     try
     {
         using (var lc = LuceneController.Instance)
         {
             ModuleController mc = new ModuleController();
             foreach (PortalInfo portal in PortalController.Instance.GetPortals())
             {
                 var modules = DnnUtils.GetDnnOpenContentModules(portal.PortalID);
                 foreach (var module in modules)
                 {
                     IndexModule(lc, module);
                 }
             }
             lc.Store.Commit();
             lc.Store.OptimizeSearchIndex(true);
         }
     }
     catch (Exception ex)
     {
         Log.Logger.Error("Error while Reindexing all OpenContent data, from all portals", ex);
     }
     finally
     {
         LuceneController.ClearInstance();
     }
     Log.Logger.Info("Finished Reindexing all OpenContent data, from all portals");
 }
Esempio n. 2
0
 public void ReIndexModuleData(int moduleId, OpenContentSettings settings)
 {
     try
     {
         using (LuceneController lc = LuceneController.Instance)
         {
             IndexModuleData(lc, moduleId, settings);
             lc.Store.Commit();
             lc.Store.OptimizeSearchIndex(true);
         }
     }
     finally
     {
         LuceneController.ClearInstance();
     }
 }
Esempio n. 3
0
 /// <summary>
 /// Use this to
 /// </summary>
 /// <param name="list">The list.</param>
 /// <param name="indexConfig">The index configuration.</param>
 /// <param name="scope">The scope.</param>
 public void ReIndexData(IEnumerable <IIndexableItem> list, FieldConfig indexConfig, string scope)
 {
     try
     {
         using (var lc = LuceneController.Instance)
         {
             DeleteAllOfType(lc, scope);
             foreach (IIndexableItem item in list)
             {
                 lc.Add(item, indexConfig);
             }
             lc.Store.Commit();
             lc.Store.OptimizeSearchIndex(true);
         }
     }
     finally
     {
         LuceneController.ClearInstance();
     }
 }
Esempio n. 4
0
 /// <summary>
 /// Use this to
 /// </summary>
 /// <param name="list">The list.</param>
 /// <param name="indexConfig">The index configuration.</param>
 /// <param name="scope">The scope.</param>
 public void ReIndexModuleData(IEnumerable <IIndexableItem> list, FieldConfig indexConfig, string scope)
 {
     try
     {
         using (LuceneController lc = LuceneController.Instance)
         {
             lc.Store.Delete(new TermQuery(new Term("$type", scope)));
             foreach (var item in list)
             {
                 lc.Add(item, indexConfig);
             }
             lc.Store.Commit();
             lc.Store.OptimizeSearchIndex(true);
         }
     }
     finally
     {
         LuceneController.ClearInstance();
     }
 }
Esempio n. 5
0
 /// <summary>
 /// Reindex all content.
 /// </summary>
 public void IndexAll(Action <LuceneController> funcRegisterAllIndexableData)
 {
     App.Services.Logger.Info("Reindexing all OpenContent data, from all portals");
     LuceneController.ClearInstance();
     try
     {
         using (var lc = LuceneController.Instance)
         {
             lc.Store.DeleteAll();
             funcRegisterAllIndexableData(lc);
             lc.Store.Commit();
             lc.Store.OptimizeSearchIndex(true);
         }
     }
     catch (Exception ex)
     {
         App.Services.Logger.Error("Error while Reindexing all OpenContent data, from all portals", ex);
     }
     finally
     {
         LuceneController.ClearInstance();
     }
     App.Services.Logger.Info("Finished Reindexing all OpenContent data, from all portals");
 }